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.
This commit is contained in:
PatR
2015-05-26 17:16:30 -07:00
parent 2174d26c47
commit 5f02b15a75
3 changed files with 10 additions and 7 deletions

View File

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

View File

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

View File

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