From 1b3d2c67813341229835cb95a4bbf263a4ddd564 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 15 Jul 2022 23:57:10 -0700 Subject: [PATCH] \#wizmakemap fix fix Check for the possibility of dead monsters on fmon when removing everything from fmon. Mustn't pass a pending dead monster to mongone() and get rid of it twice. --- src/cmd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 28d06939d..3c8cbe44b 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 cmd.c $NHDT-Date: 1655671810 2022/06/19 20:50:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.579 $ */ +/* NetHack 3.7 cmd.c $NHDT-Date: 1657954617 2022/07/16 06:56:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.593 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1035,8 +1035,12 @@ makemap_remove_mons(void) from traps, stopping eating, &c as if hero were ascending */ keepdogs(TRUE); /* (pets-only; normally we'd be using 'FALSE') */ /* get rid of all the monsters that didn't make it to 'mydogs' */ - for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) + for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { + /* if already dead, dmonsfree(below) will get rid of it */ + if (DEADMONSTER(mtmp)) + continue; makemap_unmakemon(mtmp, FALSE); + } /* some monsters retain details of this level in mon->mextra; that data becomes invalid when the level is replaced by a new one; get rid of them now if migrating or already arrived elsewhere;