From: PatR Date: Wed, 2 Mar 2022 22:43:12 +0000 (-0800) Subject: clear_bypasses() should operate on buried objects X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6f1b5c0ce0a02cd7256319a67512f3bdb198ead;p=nethack clear_bypasses() should operate on buried objects Fix an object sanity check failure: a buried object with its bypass bit set. clear_bypasses() was supposed to be clearing the bypass bit on every object but was neglecting the buried objects list and the billed objects list (and inventory of the mydogs list, but that is expected to always be empty at the time when clear_bypasses() gets called). We already had an issue with billed objects, revealed by the fuzzer soon after sanity checking was extended to test bypass/in_use/nomerge bits. That one was fixed by clearing the bypass bit of specific objects as they are being added to a shop bill. This fix should make that earlier one become obsolete, but isn't removing it. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 754291cfb..b43e39b79 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.835 $ $NHDT-Date: 1646136928 2022/03/01 12:15:28 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.836 $ $NHDT-Date: 1646260985 2022/03/02 22:43:05 $ General Fixes and Modified Features ----------------------------------- @@ -826,6 +826,12 @@ if a lit potion of oil on the floor was launched by an explosion and it hit place_object() validated coordinates after using them to index level.objects killed rope golem may drop leashes and bullwhips using magic portals and level teleporters stuns hero for a few turns +clear obj->bypass for buried objects [a giant on ice triggers a fire trap, + inventory is subjected to burning and surviving objects have their + bypass bit set, giant is killed by fire trap and drops a boulder and + other inventory, ice is melted, boulder plugs resulting pool burying + rest of giant's dropped inventory, subsequent sanity checks report + that there are buried objects which are 'flagged bypass'] Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/worn.c b/src/worn.c index 9252e33a8..92299d3ca 100644 --- a/src/worn.c +++ b/src/worn.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 worn.c $NHDT-Date: 1627505148 2021/07/28 20:45:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.77 $ */ +/* NetHack 3.7 worn.c $NHDT-Date: 1646260985 2022/03/02 22:43:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.81 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -826,6 +826,10 @@ clear_bypasses(void) otmp->bypass = 0; for (otmp = g.migrating_objs; otmp; otmp = otmp->nobj) otmp->bypass = 0; + for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) + otmp->bypass = 0; + for (otmp = g.billobjs; otmp; otmp = otmp->nobj) + otmp->bypass = 0; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; @@ -845,6 +849,11 @@ clear_bypasses(void) /* no MCORPSENM(mtmp)==PM_LONG_WORM check here; long worms can't be just created by polymorph and migrating at the same time */ } + /* this is a no-op since mydogs is only non-Null during level change or + final ascension and we aren't called at those times, but be thorough */ + for (mtmp = g.mydogs; mtmp; mtmp = mtmp->nmon) + for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) + otmp->bypass = 0; /* ball can be "floating", not on any chain */ if (uball)