From: PatR Date: Fri, 12 Aug 2016 01:53:52 +0000 (-0700) Subject: fix #H4476 - monster class via member of class X-Git-Tag: NetHack-3.6.1_RC01~625 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b848f2732d0ea801bf38873c201d65e6fde7feb3;p=nethack 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. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index d827071ae..b574d4816 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 any item drained of enchantment was blamed on the player as far as shop 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 diff --git a/src/mondata.c b/src/mondata.c index 0e924f3fc..a9d054f4c 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -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. */ /* 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) == ' ')) return i; } - /* check individual species names; not as thorough as mon_to_name() - but our caller can call that directly if desired */ - for (i = LOW_PM; i < NUMMONS; i++) { - x = mons[i].mname; - if ((p = strstri(x, in_str)) != 0 - && (p == x || *(p - 1) == ' ')) { - if (mndx_p) - *mndx_p = i; - return mons[i].mlet; - } + /* check individual species names */ + i = name_to_mon(in_str); + if (i != NON_PM) { + if (mndx_p) + *mndx_p = i; + return mons[i].mlet; } } return 0;