From 39f24cda78fd937bb8ae1c5d8e989fb9874f6307 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 28 Jan 2002 11:38:25 +0000 Subject: [PATCH] Fix "gems in apply menu" From a bug report. --- include/obj.h | 6 ++++++ src/apply.c | 8 +++----- src/invent.c | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/obj.h b/include/obj.h index fce90350f..bdb1f5e1f 100644 --- a/include/obj.h +++ b/include/obj.h @@ -216,6 +216,12 @@ struct obj { otmp->otyp == WAX_CANDLE) #define MAX_OIL_IN_FLASK 400 /* maximum amount of oil in a potion of oil */ +/* special stones */ +#define is_greystone(obj) ((obj)->otyp == LUCKSTONE || \ + (obj)->otyp == LOADSTONE || \ + (obj)->otyp == FLINT || \ + (obj)->otyp == TOUCHSTONE) + /* Flags for get_obj_location(). */ #define CONTAINED_TOO 0x1 #define BURIED_TOO 0x2 diff --git a/src/apply.c b/src/apply.c index 17d6cd644..b2c86f6e2 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2519,15 +2519,13 @@ do_break_wand(obj) return 1; } -boolean uhave_greystone() +STATIC_OVL boolean +uhave_greystone() { register struct obj *otmp; for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp->otyp == LOADSTONE || - otmp->otyp == FLINT || - otmp->otyp == LUCKSTONE || - otmp->otyp == TOUCHSTONE) + if(is_greystone(otmp)) return TRUE; return FALSE; } diff --git a/src/invent.c b/src/invent.c index f18ea8cb7..131f5e80d 100644 --- a/src/invent.c +++ b/src/invent.c @@ -819,7 +819,8 @@ register const char *let,*word; /* only applicable potion is oil, and it will only be offered as a choice when already discovered */ (otyp != POT_OIL || !otmp->dknown || - !objects[POT_OIL].oc_name_known)))) + !objects[POT_OIL].oc_name_known)) + || (otmp->oclass == GEM_CLASS && !is_greystone(otmp)))) || (!strcmp(word, "invoke") && (!otmp->oartifact && !objects[otyp].oc_unique && (otyp != FAKE_AMULET_OF_YENDOR || otmp->known) &&