From 5fe872bf981ba8242dbab37f6214bb516f7a4757 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 28 May 2024 17:56:47 +0300 Subject: [PATCH] Pet titan killed itself with a boulder A pet titan dropped a boulder over a pool, and the code killed the titan, because the code was considering the titan to be in the water. If a flyer or a floater is over the pool, don't kill them off if a boulder is dropped in there. Also make the pet movement code handle the case where the pet might've died while dropping items. --- src/do.c | 3 ++- src/dogmove.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/do.c b/src/do.c index cc0435558..ec05c5fc1 100644 --- a/src/do.c +++ b/src/do.c @@ -83,7 +83,8 @@ boulder_hits_pool( will be dead here; killing it again would yield impossible "dmonsfree: N removed doesn't match N+1 pending" when other monsters have finished their current turn */ - if ((mtmp = m_at(rx, ry)) != 0 && !DEADMONSTER(mtmp)) + if ((mtmp = m_at(rx, ry)) != 0 && !DEADMONSTER(mtmp) + && !m_in_air(mtmp)) mondied(mtmp); if (ttmp) diff --git a/src/dogmove.c b/src/dogmove.c index 60e7195ec..567ab9808 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -1010,8 +1010,8 @@ dog_move( if (edog) { j = dog_invent(mtmp, edog, udist); - if (j == 2) - return MMOVE_DIED; /* died */ + if (j == 2 || mon_offmap(mtmp)) + return DEADMONSTER(mtmp) ? MMOVE_DIED : MMOVE_DONE; else if (j == 1) goto newdogpos; /* eating something */