From: PatR Date: Wed, 27 May 2015 00:16:30 +0000 (-0700) Subject: mimics mimicking strange objects X-Git-Tag: NetHack-3.6.0_RC01~353 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f02b15a75d94f89a30688920158b1bfb1b6869f;p=nethack mimics mimicking strange objects The code that intended to have mimics occasionally take on the form of "strange object" always produced downstairs instead because S_MIMIC_DEF is greater than MAXOCLASSES. This problem was present in 3.4.3. I didn't try to go back to see how long it's been there, but strange objects used to occur once upon a time. Either nobody noticed that they'd gone away or there's an alternate way to produce them. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 44a6a38c4..4180fd84c 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -917,6 +917,7 @@ scroll of earth messages cleaned up long worms can no longer be leashed the chest in the Castle containing the wishing wand can never be trapped the vibrating square is now a trap +mimics wouldn't take on the form of "strange object" Platform- and/or Interface-Specific Fixes diff --git a/src/makemon.c b/src/makemon.c index d11079cf7..ea0ca262c 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makemon.c $NHDT-Date: 1432512767 2015/05/25 00:12:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.88 $ */ +/* NetHack 3.6 makemon.c $NHDT-Date: 1432685497 2015/05/27 00:11:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.89 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1908,10 +1908,11 @@ static NEARDATA char syms[] = { MAXOCLASSES, MAXOCLASSES + 1, RING_CLASS, WAND_CLASS, WEAPON_CLASS, FOOD_CLASS, COIN_CLASS, SCROLL_CLASS, POTION_CLASS, ARMOR_CLASS, AMULET_CLASS, TOOL_CLASS, ROCK_CLASS, GEM_CLASS, SPBOOK_CLASS, - S_MIMIC_DEF, S_MIMIC_DEF, S_MIMIC_DEF, + S_MIMIC_DEF, S_MIMIC_DEF, }; -void set_mimic_sym(mtmp) /* KAA, modified by ERS */ +void +set_mimic_sym(mtmp) register struct monst *mtmp; { int typ, roomno, rt; @@ -1999,9 +2000,9 @@ register struct monst *mtmp; } else { s_sym = syms[rn2((int) sizeof(syms))]; assign_sym: - if (s_sym >= MAXOCLASSES) { + if (s_sym == MAXOCLASSES || s_sym == MAXOCLASSES + 1) { ap_type = M_AP_FURNITURE; - appear = s_sym == MAXOCLASSES ? S_upstair : S_dnstair; + appear = (s_sym == MAXOCLASSES) ? S_upstair : S_dnstair; } else { ap_type = M_AP_OBJECT; if (s_sym == S_MIMIC_DEF) { diff --git a/src/pager.c b/src/pager.c index 0f307af3b..5ab64103f 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1432512762 2015/05/25 00:12:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1432685499 2015/05/27 00:11:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -248,7 +248,8 @@ char *buf, *monbuf; otmp->corpsenm = MCORPSENM(mtmp); Strcpy(buf, distant_name(otmp, xname)); dealloc_obj(otmp); - } + } else + Strcpy(buf, obj_descr[STRANGE_OBJECT].oc_name); } else Strcpy(buf, distant_name(otmp, xname));