R739 - dead migrating monster
- It was possible for hmon_hitmon to call mhurtle to move a monster into a hole or other trap, causing it to migrate. Then, hmon_hitmon would subtract hp, and could mark the monster as dead. Later, dmonsfree would notice the monster wasn't on the level anymore, causing the impossible. Avoid the problem by just not hurtling the monster if it's going to die. It's possible it will get lifesaved after not hurtling. Technically, if it does die, the corpse should be hurtled, but won't be. - treat jousting similarly
This commit is contained in:
@@ -896,7 +896,9 @@ int thrown;
|
||||
if (jousting) {
|
||||
You("joust %s%s",
|
||||
mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
|
||||
mhurtle(mon, u.dx, u.dy, 1);
|
||||
/* avoid migrating a dead monster */
|
||||
if (mon->mhp > tmp)
|
||||
mhurtle(mon, u.dx, u.dy, 1);
|
||||
hittxt = TRUE;
|
||||
} else
|
||||
#endif
|
||||
@@ -908,7 +910,9 @@ int thrown;
|
||||
if (canspotmon(mon))
|
||||
pline("%s %s from your powerful strike!", Monnam(mon),
|
||||
makeplural(stagger(mon->data, "stagger")));
|
||||
mhurtle(mon, u.dx, u.dy, 1);
|
||||
/* avoid migrating a dead monster */
|
||||
if (mon->mhp > tmp)
|
||||
mhurtle(mon, u.dx, u.dy, 1);
|
||||
hittxt = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user