From f8e64b296c44d238a726872318e18a165eb5d538 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 31 Mar 2018 16:55:29 -0700 Subject: [PATCH] steed sanity check Wizard mode sanity checking gave spurious "mon not on map" warnings for steed when hero is mounted. Steed is in the fmon list but not expected to be present on the map. --- doc/fixes36.1 | 1 + src/mon.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 8237d8dbd..9c1b935d1 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -536,6 +536,7 @@ gas spore explosion killing a gas spore which triggers a recursive explosion would have killer reason for outer call clobbered by inner one; when they were both "gas spore's explosion" it wouldn't be noticeable (see corresponding post-3.6.0 entry for more...) +wizard mode 'sanity_check' gave spurious "mon not on map" warnings when mounted Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/src/mon.c b/src/mon.c index 456e601e7..ae1493989 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1514769571 2018/01/01 01:19:31 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.246 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1522540516 2018/03/31 23:55:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.250 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -86,14 +86,21 @@ mon_sanity_check() if (DEADMONSTER(mtmp)) continue; x = mtmp->mx, y = mtmp->my; - if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0)) + if (!isok(x, y) && !(mtmp->isgd && x == 0 && y == 0)) { impossible("mon (%s) claims to be at <%d,%d>?", fmt_ptr((genericptr_t) mtmp), x, y); - else if (level.monsters[x][y] != mtmp) + } else if (mtmp == u.usteed) { + /* steed is in fmon list but not on the map; its + coordinates should match hero's location */ + if (x != u.ux || y != u.uy) + impossible("steed (%s) claims to be at <%d,%d>?", + fmt_ptr((genericptr_t) mtmp), x, y); + } else if (level.monsters[x][y] != mtmp) { impossible("mon (%s) at <%d,%d> is not there!", fmt_ptr((genericptr_t) mtmp), x, y); - else if (mtmp->wormno) + } else if (mtmp->wormno) { sanity_check_worm(mtmp); + } } for (x = 0; x < COLNO; x++) @@ -105,6 +112,9 @@ mon_sanity_check() if (!m) impossible("map mon (%s) at <%d,%d> not in fmon list!", fmt_ptr((genericptr_t) mtmp), x, y); + else if (mtmp == u.usteed) + impossible("steed (%s) is on the map at <%d,%d>!", + fmt_ptr((genericptr_t) mtmp), x, y); else if ((mtmp->mx != x || mtmp->my != y) && mtmp->data != &mons[PM_LONG_WORM]) impossible("map mon (%s) at <%d,%d> is found at <%d,%d>?",