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.
This commit is contained in:
PatR
2022-03-02 14:43:12 -08:00
parent 43e2f7d0ae
commit e6f1b5c0ce
2 changed files with 17 additions and 2 deletions

View File

@@ -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

View File

@@ -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)