]> granicus.if.org Git - nethack/commitdiff
fix #H4083 - globs preID'd as "uncursed"
authorPatR <rankin@nethack.org>
Sat, 9 Jan 2016 23:28:25 +0000 (15:28 -0800)
committerPatR <rankin@nethack.org>
Sat, 9 Jan 2016 23:28:25 +0000 (15:28 -0800)
I think there was also a report about this during beta testing.
Killing an ooze, slime, or pudding left a glob of same which had its
bknown flag pre-set so was immediately shown as "uncursed" even to
non-priests.  Use another way to maximize glob mergability:  allow
globs to merge even when one has bknown set and the other doesn't.

doc/fixes36.1
src/invent.c
src/mkobj.c

index 49dc28c48acb59bce32da3f1dc284dc3b1a6d76b..174c21b9588becd64bb64d0d883a7aeaca10a509 100644 (file)
@@ -104,6 +104,10 @@ covetous monsters may choose to teleport to downstairs or ladders
 doppelganger posing as Rider would never change shape
 since doppelganger posing as Rider could never revert to innate form,
        protection from shape changers turned it into genuine Rider
+don't create globs of ooze/slime/pudding with bknown flag set so pre-known to
+       be "uncursed"
+do allow globs with same curse/bless state to merge even when that state is
+       known for one and unknown for the other; result will have bknown clear
 
 
 Platform- and/or Interface-Specific Fixes
index a79c7d46b04df941e89eef7b64b94cb8a6a8a083..94ae77d7cfa2ecaabfb44c1625713faf1a32d035 100644 (file)
@@ -2880,24 +2880,46 @@ mergable(otmp, obj)
 register struct obj *otmp, *obj;
 {
     int objnamelth = 0, otmpnamelth = 0;
+
     if (obj == otmp)
         return FALSE; /* already the same object */
     if (obj->otyp != otmp->otyp)
+        return FALSE; /* different types */
+    if (obj->nomerge) /* explicitly marked to prevent merge */
         return FALSE;
+
     /* coins of the same kind will always merge */
     if (obj->oclass == COIN_CLASS)
         return TRUE;
+
     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
         || obj->no_charge != otmp->no_charge || obj->obroken != otmp->obroken
         || obj->otrapped != otmp->otrapped || obj->lamplit != otmp->lamplit
-        || obj->greased != otmp->greased || obj->oeroded != otmp->oeroded
-        || obj->oeroded2 != otmp->oeroded2 || obj->bypass != otmp->bypass)
+        || obj->bypass != otmp->bypass)
         return FALSE;
 
-    if (obj->nomerge) /* explicitly marked to prevent merge */
+    if (obj->oclass == FOOD_CLASS
+        && (obj->oeaten != otmp->oeaten || obj->orotten != otmp->orotten))
+        return FALSE;
+
+    if (obj->globby) {
+        /* globs won't merge if they have different bless/curse
+           state, but will merge non-bknown with bknown */
+        if (obj->bknown != otmp->bknown)
+            obj->bknown = otmp->bknown = 0;
+        if (obj->rknown != otmp->rknown)
+            obj->rknown = otmp->rknown = 0;
+        if (obj->greased != otmp->greased)
+            obj->greased = otmp->greased = 0;
+        /* checks beyond this point aren't applicable to globs */
+        return TRUE;
+    }
+
+    if ((obj->bknown != otmp->bknown && !Role_if(PM_PRIEST))
+        || obj->oeroded != otmp->oeroded || obj->oeroded2 != otmp->oeroded2
+        || obj->greased != otmp->greased)
         return FALSE;
 
     if ((obj->oclass == WEAPON_CLASS || obj->oclass == ARMOR_CLASS)
@@ -2905,10 +2927,6 @@ register struct obj *otmp, *obj;
             || obj->rknown != otmp->rknown))
         return FALSE;
 
-    if (obj->oclass == FOOD_CLASS
-        && (obj->oeaten != otmp->oeaten || obj->orotten != otmp->orotten))
-        return FALSE;
-
     if (obj->otyp == CORPSE || obj->otyp == EGG || obj->otyp == TIN) {
         if (obj->corpsenm != otmp->corpsenm)
             return FALSE;
@@ -3413,6 +3431,7 @@ doorganize() /* inventory organizer by Del Lamb */
                    names, strip off the name of the one being moved */
                 if (olth && !obj->oartifact && !mergable(otmp, obj)) {
                     char *holdname = ONAME(obj);
+
                     ONAME(obj) = (char *) 0;
                     /* restore name iff merging is still not possible */
                     if (!mergable(otmp, obj)) {
index 9a10231171be149c3f5a8408371c958e7ec7504d..a6f8bfd295fa56b51bfa4a474f81d2a25b9ca608 100644 (file)
@@ -819,11 +819,9 @@ boolean artif;
             }
             if (Is_pudding(otmp)) {
                 otmp->globby = 1;
-                otmp->known = otmp->bknown = otmp->rknown = otmp->dknown = 1;
-                otmp->corpsenm =
-                    PM_GRAY_OOZE + (otmp->otyp - GLOB_OF_GRAY_OOZE);
-                /* this ensures that they don't fail merging because of
-                 * BUC status or other irrelevancies */
+                otmp->known = otmp->dknown = 1;
+                otmp->corpsenm = PM_GRAY_OOZE
+                                 + (otmp->otyp - GLOB_OF_GRAY_OOZE);
             } else {
                 if (otmp->otyp != CORPSE && otmp->otyp != MEAT_RING
                     && otmp->otyp != KELP_FROND && !rn2(6)) {