From 59f49fda1b77eeb58c6a7a187910935a5d104875 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 11 Jan 2025 12:24:54 -0800 Subject: [PATCH] replace the mimic-as-monster fix The new EXTRA_SANITY_CHECK for a monster mimicking a monster. It falsely triggered if the hero was hallucinating. Just add an assertion that the monster index is within valid range. --- src/uhitm.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/uhitm.c b/src/uhitm.c index bd4ce823d..3b233c152 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -6101,17 +6101,12 @@ that_is_a_mimic( } } else if (glyph_is_monster(glyph)) { const char *mtmp_name; - int sym = glyph_to_mon(glyph); + int mndx = glyph_to_mon(glyph); -#ifdef EXTRA_SANITY_CHECKS - if (iflags.sanity_check && (int) mtmp->mappearance != sym) - impossible("mimic appearance %u does not match" - " monster #%d (glyph=%d)", - mtmp->mappearance, sym, glyph); -#endif - mtmp_name = pmname(&mons[sym], Mgender(mtmp)); + assert(mndx >= LOW_PM && mndx <= HIGH_PM); + mtmp_name = pmname(&mons[mndx], Mgender(mtmp)); Snprintf(fmtbuf, sizeof fmtbuf, - "Wait! That %s is %%s!", mtmp_name); + "Wait! That %s is really %%s!", mtmp_name); } /* cloned Wiz starts out mimicking some other monster and