]> granicus.if.org Git - nethack/commitdiff
fix issue #333 - obsolete "green slime corpse"
authorPatR <rankin@nethack.org>
Fri, 24 Apr 2020 00:31:21 +0000 (17:31 -0700)
committerPatR <rankin@nethack.org>
Fri, 24 Apr 2020 00:31:21 +0000 (17:31 -0700)
Issue was for dropping glob of green slime while swallowed by a
purple worm but also applied to pet eating habits.  Green slime
corpse doesn't exist any more; check for glob instead.

Fixes #333

doc/fixes37.0
src/do.c
src/dog.c
src/dogmove.c

index 570f79a17c8a614431d6bd28584b1e95f622446f..cf311f4adbb5aee62fc70bab5d7619dd2da17500 100644 (file)
@@ -160,6 +160,8 @@ squadprob[] in mkroom.c was defined with 5 elements but initialized only 4
 allow nurses heal attack when wielding a non-weapon/weaptool
 if riding or levitating, hero could apply bullwhip downward to pull up things
        from underwater or lava; feedback implied the item was on the surface
+some monster code was checking whether pets or engulfers were eating green
+       slime by checking for green slime corpse instead of glob
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 21f092c46f2b79804073f5137251babc3ceda965..5db6ee5d9e05ca2c9d62bf8a64405be847dcc019 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -717,9 +717,10 @@ boolean with_impact;
             if (obj->otyp == CORPSE) {
                 could_petrify = touch_petrifies(&mons[obj->corpsenm]);
                 could_poly = polyfodder(obj);
-                could_slime = (obj->corpsenm == PM_GREEN_SLIME);
                 could_grow = (obj->corpsenm == PM_WRAITH);
                 could_heal = (obj->corpsenm == PM_NURSE);
+            } else if (obj->otyp == GLOB_OF_GREEN_SLIME) {
+                could_slime = TRUE;
             }
             if (is_unpaid(obj))
                 (void) stolen_value(obj, u.ux, u.uy, TRUE, FALSE);
@@ -730,7 +731,7 @@ boolean with_impact;
                                    could_poly ? (struct permonst *) 0
                                               : &mons[PM_GREEN_SLIME],
                                    FALSE, could_slime);
-                    delobj(obj); /* corpse is digested */
+                    delobj(obj); /* corpse or glob is digested */
                 } else if (could_petrify) {
                     minstapetrify(u.ustuck, TRUE);
                     /* Don't leave a cockatrice corpse in a statue */
index 45293544f3c153d7114d79b18b36785806db9852..a19167794b4300fc7787082fcc6ca830e5caf673 100644 (file)
--- a/src/dog.c
+++ b/src/dog.c
@@ -804,21 +804,17 @@ register struct obj *obj;
                 || (acidic(fptr) && !resists_acid(mon))
                 || (poisonous(fptr) && !resists_poison(mon)))
                 return POISON;
-            /* turning into slime is preferable to starvation */
-            else if (fptr == &mons[PM_GREEN_SLIME] && !slimeproof(mon->data))
-                return starving ? ACCFOOD : POISON;
-            /* polymorphing is preferable to starvation, and the pet might also
-             * want to take their chances on it if they've been mistreated */
+            /* polymorphing is preferable to starvation, and pet might also
+               want to take its chances on that if they've been mistreated */
             else if (is_shapeshifter(fptr)) {
                 if (mon->mtame == 1) {
-                    /* A herbivore still won't eat a nonvegan corpse, but in any
-                     * other circumstance a pet with tameness 1 will happily eat
-                     * a shapeshifter. */
+                    /* A herbivore still won't eat a nonvegan corpse, but
+                       in any other circumstance a pet with tameness 1 will
+                       happily eat a shapeshifter. */
                     return (herbi && !vegan(fptr)) ? MANFOOD : CADAVER;
                 }
                 return starving ? ACCFOOD : MANFOOD;
-            }
-            else if (vegan(fptr))
+            } else if (vegan(fptr))
                 return herbi ? CADAVER : MANFOOD;
             /* most humanoids will avoid cannibalism unless starving;
                arbitrary: elves won't eat other elves even then */
@@ -828,6 +824,9 @@ register struct obj *obj;
                 return (starving && carni && !is_elf(mptr)) ? ACCFOOD : TABU;
             else
                 return carni ? CADAVER : MANFOOD;
+        case GLOB_OF_GREEN_SLIME: /* other globs use the default case */
+            /* turning into slime is preferable to starvation */
+            return (starving || slimeproof(mon->data)) ? ACCFOOD : POISON;
         case CLOVE_OF_GARLIC:
             return (is_undead(mptr) || is_vampshifter(mon))
                       ? TABU
index b10870555e26e38bdb17af7dabcbee0fb150961f..90faaad601a3a7e9b34269eb3b8bf385a988c2da 100644 (file)
@@ -220,7 +220,7 @@ boolean devour;
     deadmimic = (obj->otyp == CORPSE && (obj->corpsenm == PM_SMALL_MIMIC
                                          || obj->corpsenm == PM_LARGE_MIMIC
                                          || obj->corpsenm == PM_GIANT_MIMIC));
-    slimer = (obj->otyp == CORPSE && obj->corpsenm == PM_GREEN_SLIME);
+    slimer = (obj->otyp == GLOB_OF_GREEN_SLIME);
     poly = polyfodder(obj);
     grow = mlevelgain(obj);
     heal = mhealup(obj);