]> granicus.if.org Git - nethack/commitdiff
Eyes of the Overworld grammar
authornethack.rankin <nethack.rankin>
Thu, 18 May 2006 02:38:16 +0000 (02:38 +0000)
committernethack.rankin <nethack.rankin>
Thu, 18 May 2006 02:38:16 +0000 (02:38 +0000)
     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
src/do_wear.c

index de88d0c09427260cf647036dbbc6f23dd96eeccb..cf5a22a774728e5b4e7cd927a468fbfe58501353 100644 (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
index d7de101f99c34e0a0180e73759d7db49a8d8a259..9a31887c2dac28d5952f03070ef987780ed64d3d 100644 (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);
        }
 }