From: nethack.rankin Date: Mon, 31 Mar 2003 08:02:30 +0000 (+0000) Subject: magicbane message grammar X-Git-Tag: MOVE2GIT~2045 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3d8161353583088b11128d1d8ed30eda546235c;p=nethack magicbane message grammar > "The magic-absorbing blade scares the erinys! The erinys resist! > The erinys are stunned. You kill the erinys!" vtense() already has code to handle "erinys", but it didn't work as intended when the caller uses "the erinys" for the subject string. --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index f70f0830e..1cdc7b107 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -32,6 +32,7 @@ the screen display wasn't always up to date after map topology changes jumping over a sokobon pit would result in the player next to, not in, the pit don't let arrow, rock or dart traps provide an infinite number of objects dropping from height or throwing a normal container may damage contents +some Magicbane messages treated "erinys" as plural Platform- and/or Interface-Specific Fixes diff --git a/src/objnam.c b/src/objnam.c index ef7de0f0b..3588a17b7 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)objnam.c 3.4 2003/02/08 */ +/* SCCS Id: @(#)objnam.c 3.4 2003/03/30 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1049,7 +1049,7 @@ register const char *subj; register const char *verb; { char *buf = nextobuf(); - int len; + int len, ltmp; const char *sp, *spot; const char * const *spec; @@ -1064,6 +1064,8 @@ register const char *verb; * present tense form so we don't duplicate this code elsewhere. */ if (subj) { + if (!strncmpi(subj, "a ", 2) || !strncmpi(subj, "an ", 3)) + goto sing; spot = (const char *)0; for (sp = subj; (sp = index(sp, ' ')) != 0; ++sp) { if (!strncmp(sp, " of ", 4) || @@ -1090,15 +1092,23 @@ register const char *verb; ((spot - subj) >= 2 && !strncmp(spot-1, "ae", 2))) { /* check for special cases to avoid false matches */ len = (int)(spot - subj) + 1; - for (spec = special_subjs; *spec; spec++) - if (!strncmpi(*spec, subj, len)) goto sing; + for (spec = special_subjs; *spec; spec++) { + ltmp = strlen(*spec); + if (len == ltmp && !strncmpi(*spec, subj, len)) goto sing; + /* also check for + to catch things like "the invisible erinys" */ + if (len > ltmp && *(spot - ltmp) == ' ' && + strncmpi(*spec, spot - ltmp + 1, ltmp)) goto sing; + } return strcpy(buf, verb); } /* + * 3rd person plural doesn't end in telltale 's'; * 2nd person singular behaves as if plural. */ - if (!strcmpi(subj, "you")) return strcpy(buf, verb); + if (!strcmpi(subj, "they") || !strcmpi(subj, "you")) + return strcpy(buf, verb); } sing: