fix #H4476 - monster class via member of class

Blessed genocide of "titans" wiped out all quadrupeds because
"titan" is a prefix of "titanothere".  After class letters and
class descriptions have been rejected, Have name_to_monclass()
resort to name_to_mon() instead of doing its own less detailed
name matching.
This commit is contained in:
PatR
2016-08-11 18:53:52 -07:00
parent a72d19b905
commit b848f2732d
2 changed files with 10 additions and 11 deletions

View File

@@ -331,6 +331,9 @@ when escaping the dungeon, change "you were here" annotation in dungeon
option parsing will crash if 'playmode' option is present without a value option parsing will crash if 'playmode' option is present without a value
any item drained of enchantment was blamed on the player as far as shop any item drained of enchantment was blamed on the player as far as shop
billing was concerned, even if caused by disenchanter attack billing was concerned, even if caused by disenchanter attack
if user supplied a specific monster name when asked to choose a monster class,
first prefix match was picked rather than best match ("titan" yielded
S_quadruped due to being preceded by "titanothere" in mons[])
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mondata.c $NHDT-Date: 1446604115 2015/11/04 02:28:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.58 $ */ /* NetHack 3.6 mondata.c $NHDT-Date: 1470966820 2016/08/12 01:53:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -855,16 +855,12 @@ int *mndx_p;
if ((p = strstri(x, in_str)) != 0 && (p == x || *(p - 1) == ' ')) if ((p = strstri(x, in_str)) != 0 && (p == x || *(p - 1) == ' '))
return i; return i;
} }
/* check individual species names; not as thorough as mon_to_name() /* check individual species names */
but our caller can call that directly if desired */ i = name_to_mon(in_str);
for (i = LOW_PM; i < NUMMONS; i++) { if (i != NON_PM) {
x = mons[i].mname; if (mndx_p)
if ((p = strstri(x, in_str)) != 0 *mndx_p = i;
&& (p == x || *(p - 1) == ' ')) { return mons[i].mlet;
if (mndx_p)
*mndx_p = i;
return mons[i].mlet;
}
} }
} }
return 0; return 0;