From a0ba9d142149fe2b10c5b9f63b0193e3625d4eb7 Mon Sep 17 00:00:00 2001 From: cohrs Date: Mon, 1 Apr 2002 07:03:44 +0000 Subject: [PATCH] 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 --- doc/fixes34.1 | 2 ++ src/uhitm.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 37e7b3841..858321972 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -46,6 +46,8 @@ cannot trip over submerged objects if you're water walking wand of striking was not identified if it activated a statue trap cannot sacrifice while you're swallowed player polymorphed into an eel cannot drown breathless/amphibious monsters +avoid dmonsfree impossible message due to migrating a dead monster via + mhurtle causing the monster to end up in a hole or other trap Platform- and/or Interface-Specific Fixes diff --git a/src/uhitm.c b/src/uhitm.c index 929bb9f25..c41083403 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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; } } -- 2.40.0