steed sanity check

Wizard mode sanity checking gave spurious "mon not on map" warnings
for steed when hero is mounted.  Steed is in the fmon list but not
expected to be present on the map.
This commit is contained in:
PatR
2018-03-31 16:55:29 -07:00
parent 98b0c8d4f0
commit f8e64b296c
2 changed files with 15 additions and 4 deletions

View File

@@ -536,6 +536,7 @@ gas spore explosion killing a gas spore which triggers a recursive explosion
would have killer reason for outer call clobbered by inner one; when
they were both "gas spore's explosion" it wouldn't be noticeable (see
corresponding post-3.6.0 entry for more...)
wizard mode 'sanity_check' gave spurious "mon not on map" warnings when mounted
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1514769571 2018/01/01 01:19:31 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.246 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1522540516 2018/03/31 23:55:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.250 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -86,14 +86,21 @@ mon_sanity_check()
if (DEADMONSTER(mtmp))
continue;
x = mtmp->mx, y = mtmp->my;
if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0))
if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0)) {
impossible("mon (%s) claims to be at <%d,%d>?",
fmt_ptr((genericptr_t) mtmp), x, y);
else if (level.monsters[x][y] != mtmp)
} else if (mtmp == u.usteed) {
/* steed is in fmon list but not on the map; its
<mx,my> coordinates should match hero's location */
if (x != u.ux || y != u.uy)
impossible("steed (%s) claims to be at <%d,%d>?",
fmt_ptr((genericptr_t) mtmp), x, y);
} else if (level.monsters[x][y] != mtmp) {
impossible("mon (%s) at <%d,%d> is not there!",
fmt_ptr((genericptr_t) mtmp), x, y);
else if (mtmp->wormno)
} else if (mtmp->wormno) {
sanity_check_worm(mtmp);
}
}
for (x = 0; x < COLNO; x++)
@@ -105,6 +112,9 @@ mon_sanity_check()
if (!m)
impossible("map mon (%s) at <%d,%d> not in fmon list!",
fmt_ptr((genericptr_t) mtmp), x, y);
else if (mtmp == u.usteed)
impossible("steed (%s) is on the map at <%d,%d>!",
fmt_ptr((genericptr_t) mtmp), x, y);
else if ((mtmp->mx != x || mtmp->my != y)
&& mtmp->data != &mons[PM_LONG_WORM])
impossible("map mon (%s) at <%d,%d> is found at <%d,%d>?",