From: PatR Date: Sun, 13 Dec 2015 02:59:21 +0000 (-0800) Subject: fix bz55 - wrong plural for slice of cake X-Git-Tag: NetHack-3.6.1_RC01~1184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=637f4a4bd69028cb044a1ce16100dcccc40acd3e;p=nethack fix bz55 - wrong plural for slice of cake Entered in bugzilla prior to release: "slice of birthday cake" became "slouse of birthday cake" when made plural. "slice of pizza" used to work, but adding an entry for "louse" <-> "lice" to one of the special handling lists for singular/plural broke "slice" since only a trailing substring match is performed for entries in that particular list. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 65d8a83c6..7558e4648 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -17,6 +17,8 @@ any existing vampire shape-shifted into critter (fog cloud, bat, wolf) became an unkillable critter if vampires were genocided unlike in previous versions, an uncursed scroll of enchant armor failed to uncurse the piece of armor being enchanted (change was unintentional) +slice of {pizza,cake,&} pluralized as "slouse of ..." due to false match + with "lice" (discovered pre-3.6.0-release) Platform- and/or Interface-Specific Fixes diff --git a/src/objnam.c b/src/objnam.c index bf68842e7..7e3f6aea1 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1449740045 2015/12/10 09:34:05 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.155 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1449975408 2015/12/13 02:56:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1874,6 +1874,15 @@ const char *const *alt_as_is; /* another set like as_is[] */ } } + /* avoid false hit on one_off[].plur == "lice"; + if more of these turn up, one_off[] entries will need to flagged + as to which are whole words and which are matchable as suffices + then matching in the loop below will end up becoming more complex */ + if (!strcmpi(basestr, "slice")) { + if (to_plural) + (void) strkitten(basestr, 's'); + return TRUE; + } for (sp = one_off; sp->sing; sp++) { /* check whether endstring already matches */ same = to_plural ? sp->plur : sp->sing;