]> granicus.if.org Git - nethack/commitdiff
steed sanity check
authorPatR <rankin@nethack.org>
Sat, 31 Mar 2018 23:55:29 +0000 (16:55 -0700)
committerPatR <rankin@nethack.org>
Sat, 31 Mar 2018 23:55:29 +0000 (16:55 -0700)
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.

doc/fixes36.1
src/mon.c

index 8237d8dbd163ad17e33502d5577742e2d1b73378..9c1b935d188ca8f3d8a8d245aa055acaa21b8e95 100644 (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
index 456e601e7b40d320ed5d065fb8bc58302e7c8824..ae149398912ff045f959627c8d6c37fd6cda6745 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -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>?",