]> granicus.if.org Git - nethack/commitdiff
artifact naming tweak (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 29 Oct 2010 00:56:49 +0000 (00:56 +0000)
committernethack.rankin <nethack.rankin>
Fri, 29 Oct 2010 00:56:49 +0000 (00:56 +0000)
     3.4.3 and earlier had a bug that let players discover luck stones
and amulets of esp by attempting to name unID'd gray stones or amulets
after corresponding quest artifacts and seeing whether they got "your
hand slips" feedback.  There's been a fix for this in place for a while,
but after recent newsgroup discussion I wanted to confirm that it works
as intended for amulets as well as for gray stones.  It does.  I ended
up with "a circular amulet named T*e Eye of the Aethiopica" (where that
asterisk was something other than the original "h" due to slippage)
which looks odd to me.  I've modified the code to leave leading "the"
intact and only distort the remainder of such a name.  This doesn't go
so far as to make sure distortions don't touch the "of the" portion in
the middle although it probably should.

src/do_name.c

index 018ded4179f146c32389efe00239fb9dc4db7cf9..840d099bb1be890cfeaa5ae758dd985361fce06e 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 do_name.c       $Date$  $Revision$ */
-/*     SCCS Id: @(#)do_name.c  3.5     2008/11/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -387,7 +386,7 @@ void
 do_oname(obj)
 register struct obj *obj;
 {
-       char buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ];
+       char *bufp, buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ];
        const char *aname;
        short objtyp;
 
@@ -419,8 +418,10 @@ register struct obj *obj;
                   (we know that it must eventually target a nonspace
                   because buf[] matches a valid artifact name) */
                Strcpy(bufcpy, buf);
+               /* for "the Foo of Bar", only scuff "Foo of Bar" part */
+               bufp = !strncmpi(bufcpy, "the ", 4) ? (buf + 4) : buf;
                do {
-                   wipeout_text(buf, rnd(2), (unsigned)0);
+                   wipeout_text(bufp, rnd(2), (unsigned)0);
                } while (!strcmp(buf, bufcpy));
                pline("While engraving, your %s slips.", body_part(HAND));
                display_nhwindow(WIN_MESSAGE, FALSE);