fix plural of box

"boxen" may be hacker slang for plural of "box", but "foxen" is
definitely not the plural of "fox".  Restrict the "ox"->"oxen"
entry to full word "ox", not "*ox" suffix.
This commit is contained in:
PatR
2018-03-15 13:05:08 -07:00
parent aac0a21a7e
commit 877f403734
2 changed files with 13 additions and 7 deletions
+1
View File
@@ -608,6 +608,7 @@ when clairvoyance lets you move the cursor to examine the map (if it occurs
monster), the "for instructions type '?'" prompt could be confusing monster), the "for instructions type '?'" prompt could be confusing
prevent Mjollnir from being auto-quivered if it's been thrown without return prevent Mjollnir from being auto-quivered if it's been thrown without return
and then picked back up while quiver slot is empty and then picked back up while quiver slot is empty
plural of "fox" is not "foxen"
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+12 -7
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.178 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1521144299 2018/03/15 20:04:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.189 $ */
/* 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. */
@@ -2043,9 +2043,9 @@ static struct sing_plur one_off[] = {
{ "ovum", "ova" }, { "ovum", "ova" },
{ "ox", "oxen" }, { "ox", "oxen" },
{ "rtex", "rtices" }, /* vortex */ { "rtex", "rtices" }, /* vortex */
{ "tooth", "teeth" },
{ "serum", "sera" }, { "serum", "sera" },
{ "staff", "staves" }, { "staff", "staves" },
{ "tooth", "teeth" },
{ 0, 0 } { 0, 0 }
}; };
@@ -2065,8 +2065,7 @@ static const char *const as_is[] = {
variant instead of attempting to support both. */ variant instead of attempting to support both. */
}; };
/* singularize/pluralize decisions common to both makesingular & makeplural /* singularize/pluralize decisions common to both makesingular & makeplural */
*/
STATIC_OVL boolean STATIC_OVL boolean
singplur_lookup(basestr, endstring, to_plural, alt_as_is) singplur_lookup(basestr, endstring, to_plural, alt_as_is)
char *basestr, *endstring; /* base string, pointer to eos(string) */ char *basestr, *endstring; /* base string, pointer to eos(string) */
@@ -2090,14 +2089,20 @@ const char *const *alt_as_is; /* another set like as_is[] */
} }
} }
/* avoid false hit on one_off[].plur == "lice"; /* avoid false hit on one_off[].plur == "lice" or .sing == "goose";
if more of these turn up, one_off[] entries will need to flagged 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 as to which are whole words and which are matchable as suffices
then matching in the loop below will end up becoming more complex */ then matching in the loop below will end up becoming more complex */
if (!strcmpi(basestr, "slice") if (!strcmpi(basestr, "slice")
|| !strcmpi(basestr, "mongoose")) { || !strcmpi(basestr, "mongoose")) {
if (to_plural) if (to_plural)
(void) strkitten(basestr, 's'); Strcasecpy(endstring, "s");
return TRUE;
}
/* skip "ox" -> "oxen" entry when pluralizing "<something>ox" */
if (to_plural && strlen(basestr) > 2 && !strcmpi(endstring - 2, "ox")) {
/* "fox" -> "foxes" */
Strcasecpy(endstring, "es");
return TRUE; return TRUE;
} }
for (sp = one_off; sp->sing; sp++) { for (sp = one_off; sp->sing; sp++) {
@@ -2209,7 +2214,7 @@ const char *oldstr;
spot--; spot--;
while (spot > str && *spot == ' ') while (spot > str && *spot == ' ')
spot--; /* Strip blanks from end */ spot--; /* Strip blanks from end */
*(spot + 1) = 0; *(spot + 1) = '\0';
/* Now spot is the last character of the string */ /* Now spot is the last character of the string */
len = strlen(str); len = strlen(str);