]> granicus.if.org Git - nethack/commitdiff
partial fix for #K3242 - kops dismissed twice
authorPatR <rankin@nethack.org>
Thu, 14 Jan 2021 23:45:27 +0000 (15:45 -0800)
committerPatR <rankin@nethack.org>
Thu, 14 Jan 2021 23:45:27 +0000 (15:45 -0800)
when taming is used to pacify hostile shopkeeper.  I haven't
figured out how to reproduce and eliminate the double dismissal,
but this will prevent the second one from issuing duplicate "the
Kops (disappointed) vanish into thin air" and also from trigging
the warning "dmonsfree: N removed doesn't match 2N pending."

The first dismissal leaves defunct Kops on the monster list, as
expected; second dismissal found them still there and sent them
away again instead of skipping them as already gone.

src/shk.c

index e12937de27be4047b1c9f5631baecdacbbf87b04..fd47041e6db8d9d0d48c4fff0260443085721ee2 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 shk.c   $NHDT-Date: 1607754748 2020/12/12 06:32:28 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.193 $ */
+/* NetHack 3.7 shk.c   $NHDT-Date: 1610667899 2021/01/14 23:44:59 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.195 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -4495,11 +4495,13 @@ static void
 kops_gone(silent)
 boolean silent;
 {
-    register int cnt = 0;
-    register struct monst *mtmp, *mtmp2;
+    int cnt = 0;
+    struct monst *mtmp, *mtmp2;
 
     for (mtmp = fmon; mtmp; mtmp = mtmp2) {
         mtmp2 = mtmp->nmon;
+        if (DEADMONSTER(mtmp))
+            continue;
         if (mtmp->data->mlet == S_KOP) {
             if (canspotmon(mtmp))
                 cnt++;