From: PatR Date: Sun, 24 Apr 2022 21:44:40 +0000 (-0700) Subject: fix mon_leaving_level X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2708d3b330b290cb1f2d10dee20feacf15e08200;p=nethack fix mon_leaving_level Reported directly to devteam: changing levels while riding gave an impossible warning, "no monster to remove". mon_leaving_level() was trying to take hero's steed off the map but that isn't on the map in the first place. Only noticable if built with EXTRA_SANITY_CHECKS enabled. Normally remove_monster(x,y) just sets level.monsters[x,y] to Null but with extra checks enabled it first checks whether that is already Null. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 5b31b29d7..147e07faf 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.870 $ $NHDT-Date: 1649530942 2022/04/09 19:02:22 $ +HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.890 $ $NHDT-Date: 1650836671 2022/04/24 21:44:31 $ General Fixes and Modified Features ----------------------------------- @@ -1173,6 +1173,8 @@ one-shot food testing ability conferred by blessed scroll of food detection worn ring of slow digestion blocks per-turn hunger but not the hunger caused by wearing it; white dragon scales/mail was blocking per-turn hunger and didn't cause any hunger itself; change to treat it like the ring +if the progarm was built with EXTRA_SANITY_CHECKS enabled, changing levels + while riding would give impossible warning "no monster to remove" curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/mon.c b/src/mon.c index c7ea09be5..ed5060b99 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mon.c $NHDT-Date: 1647911478 2022/03/22 01:11:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.419 $ */ +/* NetHack 3.7 mon.c $NHDT-Date: 1650836671 2022/04/24 21:44:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.423 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2310,7 +2310,7 @@ static void mon_leaving_level(struct monst *mon) { int mx = mon->mx, my = mon->my; - boolean onmap = mx > 0; + boolean onmap = (mx > 0 && mon != u.usteed); /* to prevent an infinite relobj-flooreffects-hmon-killed loop */ mon->mtrapped = 0;