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.
This commit is contained in:
PatR
2022-04-24 14:44:40 -07:00
parent 238fa9f694
commit 2708d3b330
2 changed files with 5 additions and 3 deletions

View File

@@ -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

View File

@@ -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;