From e181efb600a2055b405c73e9bc16ce431bd69d9e Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 29 Oct 2010 00:56:49 +0000 Subject: [PATCH] artifact naming tweak (trunk only) 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index 018ded417..840d099bb 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -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);