]> granicus.if.org Git - nethack/commitdiff
mon_sanity_check tweak
authorPatR <rankin@nethack.org>
Wed, 12 Dec 2018 23:42:46 +0000 (15:42 -0800)
committerPatR <rankin@nethack.org>
Wed, 12 Dec 2018 23:42:46 +0000 (15:42 -0800)
A change I included with the vault guard fix was triggering fuzzer
panics about dead monsters on the fmons list.  I'm not quite sure why;
I couldn't reproduce it interactively.  [Perhaps caused by hero killing
a monster and then getting another move before monsters get their turn,
but trying to do that still didn't trip the dead monster sanity check.]
Suppress that check so that the fuzzer can run amok.

Also, a waiting-to-exit vault guard could move extra times, uselessly
since ''hero hasn't left temporary corridor yet'' is why he's waiting,
if there were any monsters fast enough to get extra moves before the
hero's next turn.

src/mon.c

index 74edcccd743d8bea3360bb0942c7404d0af94eef..de037e42b8d66e9e12a96bead9476564a9111c66 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 mon.c   $NHDT-Date: 1544608467 2018/12/12 09:54:27 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.273 $ */
+/* NetHack 3.6 mon.c   $NHDT-Date: 1544658160 2018/12/12 23:42:40 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.274 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -60,10 +60,12 @@ const char *msg;
             mtmp->mnum = mndx;
         }
         if (DEADMONSTER(mtmp)) {
+#if 0
             /* bad if not fmons list or if not vault guard */
             if (strcmp(msg, "fmon") || !mtmp->isgd)
                 impossible("dead monster on %s; %s at <%d,%d>",
                            msg, mons[mndx].mname, mtmp->mx, mtmp->my);
+#endif
             return;
         }
         if (chk_geno && (mvitals[mndx].mvflags & G_GENOD) != 0)
@@ -89,6 +91,7 @@ mon_sanity_check()
     struct monst *mtmp, *m;
 
     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+        /* dead monsters should still have sane data */
         sanity_check_single_mon(mtmp, TRUE, "fmon");
         if (DEADMONSTER(mtmp) && !mtmp->isgd)
             continue;
@@ -727,7 +730,10 @@ movemon()
            mon->isgd flag so that dmonsfree() will get rid of mon) */
         if (mtmp->isgd && !mtmp->mx) {
             /* parked at <0,0>; eventually isgd should get set to false */
-            (void) gd_move(mtmp);
+            if (monstermoves > mtmp->mlstmv) {
+                (void) gd_move(mtmp);
+                mtmp->mlstmv = monstermoves;
+            }
             continue;
         }
         if (DEADMONSTER(mtmp))