MCPcopy Create free account
hub / github.com/NetHack/NetHack / tin_variety

Function tin_variety

src/eat.c:1488–1512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1486}
1487
1488staticfn int
1489tin_variety(
1490 struct obj *obj,
1491 boolean displ) /* we're just displaying so leave things alone */
1492{
1493 int r, mnum = obj->corpsenm;
1494
1495 if (obj->spe == 1) {
1496 r = SPINACH_TIN;
1497 } else if (obj->cursed) {
1498 r = ROTTEN_TIN; /* always rotten if cursed */
1499 } else if (obj->spe < 0) {
1500 r = -(obj->spe);
1501 --r; /* get rid of the offset */
1502 } else {
1503 r = rn2(TTSZ - 1);
1504 }
1505
1506 if (!displ && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
1507 r = ROTTEN_TIN; /* some homemade tins go bad */
1508
1509 if (r == ROTTEN_TIN && (ismnum(mnum) && nonrotting_corpse(mnum)))
1510 r = HOMEMADE_TIN; /* lizards don't rot */
1511 return r;
1512}
1513
1514/* finish consume_tin(); also potentially used by cprefx() and cpostfx() */
1515staticfn void

Callers 3

tin_detailsFunction · 0.85
set_tin_varietyFunction · 0.85
consume_tinFunction · 0.85

Calls 1

rn2Function · 0.85

Tested by

no test coverage detected