]> granicus.if.org Git - nethack/commitdiff
makeplural/makesingular support for foo-at-bar (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 25 Oct 2005 01:47:03 +0000 (01:47 +0000)
committernethack.rankin <nethack.rankin>
Tue, 25 Oct 2005 01:47:03 +0000 (01:47 +0000)
     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.

doc/fixes35.0
src/objnam.c

index fcd1b6997123a3717d4daa1bbf3d321150cd39b8..ea0d5510604884510694ad9719d18a5d8bf08029 100644 (file)
@@ -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
index d416eff2e6cf3fcfb2891bf9af3f5bdfcb0b1186..b1c5ef1ff7733ab19b74539a4e008665c42081ed 100644 (file)
@@ -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 */
        }