pull request #1175 - obj->corpsenm fixes

Pull request by mkuoppal:  some objects which use the corpsenm field
to access the mons[] array can have a corpsenm value of NON_PM (-1)
and weren't avoiding array access in those cases.

In addition to a fixes entry for it, this makes some revisions to the
commited code, handling a few of the cases differently.

Closes #1175
This commit is contained in:
PatR
2024-01-06 15:13:31 -08:00
parent 4669676fc0
commit 83bdf71932
5 changed files with 34 additions and 40 deletions

View File

@@ -199,6 +199,8 @@
#define touch_petrifies(ptr) \
((ptr) == &mons[PM_COCKATRICE] || (ptr) == &mons[PM_CHICKATRICE])
/* Medusa doesn't pass touch_petrifies() but does petrify if eaten */
#define flesh_petrifies(pm) (touch_petrifies(pm) || (pm) == &mons[PM_MEDUSA])
/* missiles made of rocks don't harm these: xorns and earth elementals
(but not ghosts and shades because that would impact all missile use