From: nethack.rankin Date: Tue, 25 Oct 2005 01:47:03 +0000 (+0000) Subject: makeplural/makesingular support for foo-at-bar (trunk only) X-Git-Tag: MOVE2GIT~1219 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f5c035b3ba156f930720aac884a1ef760b1de3d;p=nethack makeplural/makesingular support for foo-at-bar (trunk only) Suggested by Janet, after inhaling paint fumes. Unlike mother-in-law, which is an entry in the hallucinating monsters list and would be pluralized if chosen as a tin description, I think the rank title man-at-arms will only ever go through plural/singular handling if used as a fruit name. But since the man/men part was already implemented for pluralization, adding the -at- part is trivial. Also adds men/man singularization for the general case where -at- isn't involved. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index fcd1b6997..ea0d55106 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -94,6 +94,7 @@ fix pluralization for "this tin smells like mother-in-laws" when hallucinating try harder to keep pluralization straight when user assigns an already plural value for named fruit avoid false matches when looking up fruit names ("grapefruit" isn't "grape") +handle pluralization of man-at-arms and singularization of men-at-arms Platform- and/or Interface-Specific Fixes diff --git a/src/objnam.c b/src/objnam.c index d416eff2e..b1c5ef1ff 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1371,7 +1371,8 @@ const char *oldstr; || !strncmp(spot, " de ", 4) || !strncmp(spot, " d'", 3) || !strncmp(spot, " du ", 4) - || !strncmp(spot, "-in-", 4)) { + || !strncmp(spot, "-in-", 4) + || !strncmp(spot, "-at-", 4)) { excess = oldstr + (int) (spot - str); *spot = 0; break; @@ -1612,7 +1613,10 @@ const char *oldstr; recursively since it can't recognize whether we should be removing "es" rather than just "s" */ if ((p = strstri(bp, " of ")) != 0 || - (p = strstri(bp, "-in-")) != 0) { + (p = strstri(bp, "-in-")) != 0 || + (p = strstri(bp, "-at-")) != 0) { + /* [wo]men-at-arms -> [wo]man-at-arms; takes "not end in s" exit */ + if (!BSTRNCMP(bp, p-3, "men", 3)) *(p-2) = 'a'; if (BSTRNCMP(bp, p-1, "s", 1)) return bp; /* wasn't plural */ --p; /* back up to the 's' */ /* but don't singularize "gauntlets", "boots", "Eyes of the.." */ @@ -1693,11 +1697,14 @@ const char *oldstr; Strcpy(p-5, "tooth"); return bp; } - if (!BSTRCMP(bp, p-5, "fungi")) { Strcpy(p-5, "fungus"); return bp; } + if (!BSTRCMP(bp, p-3, "men")) { + Strcpy(p-3, "man"); + return bp; + } /* here we cannot find the plural suffix */ }