From: nethack.rankin Date: Tue, 1 Oct 2002 07:23:10 +0000 (+0000) Subject: touchstone use X-Git-Tag: MOVE2GIT~2396 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3a9637ba7291634e59fe52a73598b870beec004;p=nethack touchstone use Make touchstones more convenient to use after they're identified by only listing unknown gems as likely candidates. This doesn't prevent other stuff from being rubbed on them, just alters the prompt string and the subset of inventory shown for '?'. --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 02ada2286..26e614b8d 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -260,6 +260,7 @@ can no longer activate a figurine while engulfed can't use figurines to get too many erinyes or Nazgul include currently wielded weapon among the list of likely choices for 'w' likewise for currently quivered ammo among choices for 'Q' +only include unknown gems as likely choices when applying known touchstone prevent mbodypart() from returning animal parts for lights removing a ring might relearn what it is after amnesia diff --git a/src/apply.c b/src/apply.c index 0a277339a..2b6ec335f 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1846,16 +1846,23 @@ struct obj *tstone; { struct obj *obj; boolean do_scratch; - const char *streak_color; + const char *streak_color, *choices; char stonebuf[QBUFSZ]; static const char scritch[] = "\"scritch, scritch\""; static const char allowall[3] = { COIN_CLASS, ALL_CLASSES, 0 }; + static const char justgems[3] = { ALLOW_NONE, GEM_CLASS, 0 }; #ifndef GOLDOBJ struct obj goldobj; #endif + /* in case it was acquired while blinded */ + if (!Blind) tstone->dknown = 1; + /* when the touchstone is fully known, don't bother listing extra + junk as likely candidates for rubbing */ + choices = (tstone->otyp == TOUCHSTONE && tstone->dknown && + objects[TOUCHSTONE].oc_name_known) ? justgems : allowall; Sprintf(stonebuf, "rub on the stone%s", plur(tstone->quan)); - if ((obj = getobj(allowall, stonebuf)) == 0) + if ((obj = getobj(choices, stonebuf)) == 0) return; #ifndef GOLDOBJ if (obj->oclass == COIN_CLASS) { diff --git a/src/invent.c b/src/invent.c index bf0a58c5e..b75966709 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)invent.c 3.4 2002/09/16 */ +/* SCCS Id: @(#)invent.c 3.4 2002/09/30 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -863,6 +863,9 @@ register const char *let,*word; otyp != OIL_LAMP && otyp != MAGIC_LAMP && otyp != BRASS_LANTERN) || (otmp->oclass == GEM_CLASS && !is_graystone(otmp)))) + || (!strncmp(word, "rub on the stone", 16) && + *let == GEM_CLASS && /* using known touchstone */ + otmp->dknown && objects[otyp].oc_name_known) || ((!strcmp(word, "use or apply") || !strcmp(word, "untrap with")) && /* Picks, axes, pole-weapons, bullwhips */