From a232123d8cb035f9b8fbc5301127847f314060dd Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 18 May 2006 02:38:16 +0000 Subject: [PATCH] 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. --- doc/fixes34.4 | 1 + src/do_wear.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index de88d0c09..cf5a22a77 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/do_wear.c b/src/do_wear.c index d7de101f9..9a31887c2 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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); } } -- 2.40.0