1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-28 00:12:23 +01:00

Fix more unguarded &mons[otmp->corpsenm] checks in eat.c

This commit is contained in:
NeroOneTrueKing 2020-09-30 13:28:17 -05:00
parent 866dc5b2c0
commit 37a7626738

View file

@ -2522,7 +2522,7 @@ register struct obj *otmp;
}
break;
case EGG:
if (touch_petrifies(&mons[otmp->corpsenm])) {
if (otmp->corpsenm != NON_PM && touch_petrifies(&mons[otmp->corpsenm])) {
if (!Stone_resistance &&
!(poly_when_stoned(youracedata) && polymon(PM_STONE_GOLEM))) {
if (!Stoned) Stoned = 5;
@ -2570,9 +2570,10 @@ struct obj *otmp;
if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) {
/* These checks must match those in eatcorpse() */
stoneorslime = (touch_petrifies(&mons[mtyp]) &&
stoneorslime = (mtyp != NON_PM && (
touch_petrifies(&mons[mtyp]) &&
!Stone_resistance &&
!poly_when_stoned(youracedata));
!poly_when_stoned(youracedata)));
if (mtyp == PM_GREEN_SLIME || mtyp == PM_FLUX_SLIME)
stoneorslime = (!Unchanging && !flaming(youracedata) &&
@ -3621,7 +3622,7 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
if(otmp->ostolen && u.sealsActive&SEAL_ANDROMALIUS) unbind(SEAL_ANDROMALIUS,TRUE);
if(otmp->otyp == EGG && u.sealsActive&SEAL_ECHIDNA) unbind(SEAL_ECHIDNA,TRUE);
if(otmp->otyp >= APPLE && otmp->otyp <= BANANA && u.sealsActive&SEAL_EVE) unbind(SEAL_EVE,TRUE);
if(is_giant(&mons[otmp->corpsenm]) && u.sealsActive&SEAL_YMIR) unbind(SEAL_YMIR,TRUE);
if(otmp->corpsenm != NON_PM && is_giant(&mons[otmp->corpsenm]) && u.sealsActive&SEAL_YMIR) unbind(SEAL_YMIR,TRUE);
victual.piece = otmp = touchfood(otmp);
victual.usedtime = 0;