]> granicus.if.org Git - nethack/commitdiff
fix B10003 - GOLDOBJ: BUC gold; identification
authornethack.rankin <nethack.rankin>
Tue, 24 Sep 2002 03:20:22 +0000 (03:20 +0000)
committernethack.rankin <nethack.rankin>
Tue, 24 Sep 2002 03:20:22 +0000 (03:20 +0000)
     Curse and bless status has no meaning for gold.  Likewise
for erosion and other object flags controlling whether an item is
considered to be fully identified.

doc/fixes34.1
src/invent.c
src/mkobj.c
src/objnam.c
src/sit.c

index c7a87b5bda41497b77b31c913cb875525700f45a..ccfe90b678b60917a273695c722a837407e5d352 100644 (file)
@@ -255,6 +255,7 @@ for wizard and explore modes, skip second screen of ^X output when first
        screen is cancelled by ESC
 polyself into minotaur causes hard headgear to fall off
 with multiple leashes in use, 2nd had 50/50 chance of having unbounded length
+GOLDOBJ: coins aren't subject to curses/blesses and don't need identification
 
 
 Platform- and/or Interface-Specific Fixes
index 4350e5758f8f153e5473370ff104f35e99f4de5e..ed9d1208413f72d5cd71265d1717c0938a506407 100644 (file)
@@ -2228,16 +2228,12 @@ STATIC_OVL boolean
 mergable(otmp, obj)    /* returns TRUE if obj  & otmp can be merged */
        register struct obj *otmp, *obj;
 {
-#ifndef GOLDOBJ
-       if (obj->otyp != otmp->otyp || obj->unpaid != otmp->unpaid ||
-#else
        if (obj->otyp != otmp->otyp) return FALSE;
-       
-        /* Coins of the same kind will always merge. */
-        if (obj->oclass == COIN_CLASS) return TRUE;
-
-        if (obj->unpaid != otmp->unpaid ||
+#ifdef GOLDOBJ
+       /* coins of the same kind will always merge */
+       if (obj->oclass == COIN_CLASS) return TRUE;
 #endif
+       if (obj->unpaid != otmp->unpaid ||
            obj->spe != otmp->spe || obj->dknown != otmp->dknown ||
            (obj->bknown != otmp->bknown && !Role_if(PM_PRIEST)) ||
            obj->cursed != otmp->cursed || obj->blessed != otmp->blessed ||
index 6ea149f811db25229005b3ea4fb0c57aaf0f348b..cf4da5daf754e7ef5249c93052708536b3534110 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mkobj.c    3.4     2002/08/02      */
+/*     SCCS Id: @(#)mkobj.c    3.4     2002/09/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -679,6 +679,9 @@ void
 bless(otmp)
 register struct obj *otmp;
 {
+#ifdef GOLDOBJ
+       if (otmp->oclass == COIN_CLASS) return;
+#endif
        otmp->cursed = 0;
        otmp->blessed = 1;
        if (otmp->otyp == LUCKSTONE
@@ -707,6 +710,9 @@ void
 curse(otmp)
 register struct obj *otmp;
 {
+#ifdef GOLDOBJ
+       if (otmp->oclass == COIN_CLASS) return;
+#endif
        otmp->blessed = 0;
        otmp->cursed = 1;
        /* welded two-handed weapon interferes with some armor removal */
index 52269611b382993cb75d7a713311f6016de4cbc1..9c5fe3d57f8f4f8b63dc6cfc6e091e7f54c1e862 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)objnam.c   3.4     2002/09/08      */
+/*     SCCS Id: @(#)objnam.c   3.4     2002/09/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -797,6 +797,10 @@ boolean
 not_fully_identified(otmp)
 register struct obj *otmp;
 {
+#ifdef GOLDOBJ
+    /* gold doesn't have any interesting attributes [yet?] */
+    if (otmp->oclass == COIN_CLASS) return FALSE;      /* always fully ID'd */
+#endif
     /* check fundamental ID hallmarks first */
     if (!otmp->known || !otmp->dknown ||
 #ifdef MAIL
index 7b6550f673e0c8b6363d06d0e2afb04f5ed81c1f..d8b4724e9c0d1a2a4d66cf1ae6c21f661602bb86 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)sit.c      3.4     2002/07/12      */
+/*     SCCS Id: @(#)sit.c      3.4     2002/09/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -325,14 +325,27 @@ rndcurse()                        /* curse a few inventory items at random! */
            You(mal_aura, "you");
        }
 
-       for (otmp = invent; otmp; otmp = otmp->nobj)  nobj++;
-
+       for (otmp = invent; otmp; otmp = otmp->nobj) {
+#ifdef GOLDOBJ
+           /* gold isn't subject to being cursed or blessed */
+           if (otmp->oclass == COIN_CLASS) continue;
+#endif
+           nobj++;
+       }
        if (nobj) {
            for (cnt = rnd(6/((!!Antimagic) + (!!Half_spell_damage) + 1));
                 cnt > 0; cnt--)  {
-               onum = rn2(nobj);
-               for(otmp = invent; onum != 0; onum--)
-                   otmp = otmp->nobj;
+               onum = rnd(nobj);
+               for (otmp = invent; otmp; otmp = otmp->nobj) {
+#ifdef GOLDOBJ
+                   /* as above */
+                   if (otmp->oclass == COIN_CLASS) continue;
+#endif
+                   if (--onum == 0) break;     /* found the target */
+               }
+               /* the !otmp case should never happen; picking an already
+                  cursed item happens--avoid "resists" message in that case */
+               if (!otmp || otmp->cursed) continue;    /* next target */
 
                if(otmp->oartifact && spec_ability(otmp, SPFX_INTEL) &&
                   rn2(10) < 8) {