From: PatR Date: Thu, 14 Jan 2021 23:45:27 +0000 (-0800) Subject: partial fix for #K3242 - kops dismissed twice X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f9115fae636c590bd31688c4565f1739209605;p=nethack partial fix for #K3242 - kops dismissed twice 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. --- diff --git a/src/shk.c b/src/shk.c index e12937de2..fd47041e6 100644 --- 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++;