Fix several touchstone-related things:

1. The switch statement was using the material "GOLD"
   rather than GOLD_CLASS.
2. If getobj() had been working for gold when it
   came to touchstones, there would have been a
   memory leak here because the object returned
   would have been from mkgoldobj().  The goldobj
   was not being freed anywhere, nor was it being
   put on a chain. You also would have had zero
   gold after rubbing it on the stone. The intent
   was clearly to allow gold since there was a
   case in the switch statement.
3. getobj() wasn't working properly for gold
   selection here anyway, so this was
   not the cause of <Someone>'s gold obj in inventory.
   You ended up dropping through to code that
   was supposed to print "You cannot verb object."
   For touchstones that came out as:
   "You cannot rub on the stone gold."
This commit is contained in:
nethack.allison
2002-01-24 02:39:55 +00:00
parent 3fc3ef8537
commit 4c46f6eb2b
2 changed files with 12 additions and 1 deletions

View File

@@ -1838,8 +1838,15 @@ struct obj *otmp;
}
switch (obj->oclass) {
case GOLD:
case GOLD_CLASS:
color = "golden";
#ifndef GOLDOBJ
/* goldobj back to u.ugold */
u.ugold = obj->quan;
obj->quan = 0L;
dealloc_obj(obj);
obj = (struct obj *)0;
#endif
break;
case GEM_CLASS:
if (otmp->blessed) {

View File

@@ -729,6 +729,10 @@ register const char *let,*word;
#else
if(*let == GOLD_CLASS) let++, usegold = TRUE;
#endif
/* Ugly check for touchstone */
if (!strncmp(word, "rub on", 6) && u.ugold)
allowgold = usegold = TRUE;
/* Equivalent of an "ugly check" for gold */
if (usegold && !strcmp(word, "eat") && !metallivorous(youmonst.data))
#ifndef GOLDOBJ