thawing ice followup

Modifying an() [actually just_an()] to treat "<thickness> ice" and
"frozen <hallucinatory liquid>" as special cases which shouldn't be
prefixed with "a" or "an" affected using something like "shaved ice"
or "frozen yogurt" as named fruit.
 |a) shaved ice
 |b) frozen yogurt (weapon in hand)
now have article "a" preceding them:
 |a) a shaved ice
 |b) a frozen yogurt (weapon in hand)
However, the existing cases
 |c) iron bars
 |d) an iron bars (weapon in hand)
still get item 'c' wrong.  'd' is slightly odd but that's because the
fruit name is ambiguous as to whether it's singular or plural.
This commit is contained in:
PatR
2023-10-26 01:28:56 -07:00
parent 04d6789c98
commit 4dc8429d9e
5 changed files with 52 additions and 18 deletions

View File

@@ -4359,8 +4359,26 @@ look_here(
}
}
if (dfeature && !skip_dfeature)
Sprintf(fbuf, "There is %s here.", an(dfeature));
if (dfeature && !skip_dfeature) {
const char *p;
int article = 1; /* 0 => none, 1 => a/an, 2 => the (not used here) */
/* "molten lava", "iron bars", and plain "ice" are handled as special
cases in an() but probably shouldn't be; don't rely on that */
if (!strcmp(dfeature, "molten lava")
|| !strcmp(dfeature, "iron bars")
|| !strcmp(dfeature, "ice")
|| !strncmp(dfeature, "frozen ", 7) /* ice while hallucinating */
/* thawing ice ("solid ice", "thin ice", &c) */
|| ((p = strchr(dfeature, ' ')) != 0 && !strcmpi(p, " ice")))
article = 0;
if (article == 1)
dfeature = an(dfeature);
/* hardcoded "is" worked here because "iron bars" is actually
"set of iron bars"; use vtense() instead of relying on that */
Sprintf(fbuf, "There %s %s here.", vtense(dfeature, "are"), dfeature);
}
if (!otmp || is_lava(u.ux, u.uy)
|| (is_pool(u.ux, u.uy) && !Underwater)) {