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.
This commit is contained in:
nethack.rankin
2003-03-31 08:02:30 +00:00
parent 66ece5d870
commit b3d8161353
2 changed files with 16 additions and 5 deletions

View File

@@ -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

View File

@@ -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 <prefix><space><special_subj>
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: