From 6677003c8fea45f175a95798040277378129f40a Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 23 Apr 2020 17:31:21 -0700 Subject: [PATCH] fix issue #333 - obsolete "green slime corpse" 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 | 2 ++ src/do.c | 5 +++-- src/dog.c | 19 +++++++++---------- src/dogmove.c | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 570f79a17..cf311f4ad 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/do.c b/src/do.c index 21f092c46..5db6ee5d9 100644 --- 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 */ diff --git a/src/dog.c b/src/dog.c index 45293544f..a19167794 100644 --- 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 diff --git a/src/dogmove.c b/src/dogmove.c index b10870555..90faaad60 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -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);