plug luckstone identification hole (trunk only)

From the newsgroup:  when you pick up a gray stone, you can determine
whether it is a luckstone by attempting to name it "the Heart of Ahriman".
Your "fingers slip" if it is, they don't if it isn't.  That's way too
cheesy for my tastes.  This patch will make the finger slipping occur for
any item that has the same description rather than just for the exact type.
Now you won't be able to name any type of gray stone "the Heart of Ahriman"
(nor an elven broadsword "Stormbringer"; however, assuming that you manage
to acquire a non-artifact runesword, you can still uselessly name it
"Orcrist" if you want).
This commit is contained in:
nethack.rankin
2005-11-12 05:30:11 +00:00
parent 90a9978c33
commit d5be1ff3f1
2 changed files with 15 additions and 3 deletions

View File

@@ -95,6 +95,8 @@ try harder to keep pluralization straight when user assigns an already plural
value for named fruit
avoid false matches when looking up fruit names ("grapefruit" isn't "grape")
handle pluralization of man-at-arms and singularization of men-at-arms
assigning an artifact name is rejected on objects with similar description to
corresponding artifact's type rather than just those of the same type
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)artifact.c 3.5 2005/10/01 */
/* SCCS Id: @(#)artifact.c 3.5 2005/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -279,17 +279,27 @@ register struct obj *otmp;
register const char *name;
{
register const struct artifact *a;
register const char *aname;
const char *aname, *odesc, *other;
boolean sametype[NUM_OBJECTS];
int i, otyp = otmp->otyp, ocls = objects[otyp].oc_class;
if (!*name) return FALSE;
if (!strncmpi(name, "the ", 4)) name += 4;
/* find any alternate types which have the same description as otyp */
odesc = OBJ_DESCR(objects[otyp]);
for (i = 0; i < NUM_OBJECTS; i++)
sametype[i] = (i == otyp ||
(objects[i].oc_class == ocls &&
odesc && (other = OBJ_DESCR(objects[i])) != 0 &&
!strcmp(odesc, other)));
/* Since almost every artifact is SPFX_RESTR, it doesn't cost
us much to do the string comparison before the spfx check.
Bug fix: don't name multiple elven daggers "Sting".
*/
for (a = artilist+1; a->otyp; a++) {
if (a->otyp != otmp->otyp) continue;
if (!sametype[a->otyp]) continue;
aname = a->name;
if (!strncmpi(aname, "the ", 4)) aname += 4;
if (!strcmp(aname, name))