Eyes of the Overworld grammar

Putting on the Eyes while blind causes sight to be regained, which in
turn causes xname() to set the dknown bit and start using the previously
unseen object's name.  But obj_is_pname() was being called before xname in
the "you are now wearing ..." message, while dknown was still clear.  So
obj_is_pname thought the name was being suppressed and returned false,
resulting in "an Eyes" instead of "the Eyes".  Fix is to call xname first.
This commit is contained in:
nethack.rankin
2006-05-18 02:38:16 +00:00
parent a6c608403b
commit a232123d8c
2 changed files with 9 additions and 5 deletions

View File

@@ -220,6 +220,7 @@ create_object() created lizard corpses without timers and troll corpses with
when a potion of acid was dropped into water and exploded, nethack would
continue to use already freed memory and later might panic or crash
when jumping over an already seen trap, use an() to get appropriate grammar
fix bad grammar when putting on not-yet-seen Eyes of the Overworld while blind
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)do_wear.c 3.5 2005/12/07 */
/* SCCS Id: @(#)do_wear.c 3.5 2006/05/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -51,25 +51,28 @@ STATIC_DCL void FDECL(already_wearing2, (const char*, const char*));
void
off_msg(otmp)
register struct obj *otmp;
struct obj *otmp;
{
if(flags.verbose)
if (flags.verbose)
You("were wearing %s.", doname(otmp));
}
/* for items that involve no delay */
STATIC_OVL void
on_msg(otmp)
register struct obj *otmp;
struct obj *otmp;
{
if (flags.verbose) {
char how[BUFSZ];
/* call xname() before obj_is_pname(); formatting obj's name
might set obj->dknown and that affects the pname test */
const char *otmp_name = xname(otmp);
how[0] = '\0';
if (otmp->otyp == TOWEL)
Sprintf(how, " around your %s", body_part(HEAD));
You("are now wearing %s%s.",
obj_is_pname(otmp) ? the(xname(otmp)) : an(xname(otmp)),
obj_is_pname(otmp) ? the(otmp_name) : an(otmp_name),
how);
}
}