From 3f4634211f712b8bc801106bc1ec5493047273c5 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 8 May 2023 02:07:31 -0700 Subject: [PATCH] fix #K3918 - statue-to-boulder polymorph in water 'sanity_check' complains if it finds a boulder in water or lava. Polymorphig a statue usually produces another statue but might produce a boulder. If done it water, keeping the boulder intact would trigger the sanity warning. Break it into rocks if object polymorph produces a boulder at water or lava location. --- doc/fixes3-7-0.txt | 2 ++ src/zap.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 15246339d..ce1d425e3 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1180,6 +1180,8 @@ hangup in wizard or explore mode would result in answering ESC to "Die?" process was probably killed without anyone knowing why it happened] with OPTIONS=blind (blind from birth), being inflicted with timed blinding yielded "your vision seems to dim for a moment but is normal now" +avoid sanity_check warning if statue in water or lava gets polymorphed into a + boulder; break it into a stack of rocks if that would happen Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/zap.c b/src/zap.c index 54d011315..a9f859c2a 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1860,12 +1860,16 @@ poly_obj(struct obj *obj, int id) } } /* old_wornmask */ } else if (obj_location == OBJ_FLOOR) { - if (obj->otyp == BOULDER && otmp->otyp != BOULDER - && !does_block(ox, oy, &levl[ox][oy])) - unblock_point(ox, oy); - else if (obj->otyp != BOULDER && otmp->otyp == BOULDER) - /* (checking does_block() here would be redundant) */ - block_point(ox, oy); + if (obj->otyp == BOULDER && otmp->otyp != BOULDER) { + if (!does_block(ox, oy, &levl[ox][oy])) + unblock_point(ox, oy); + } else if (obj->otyp != BOULDER && otmp->otyp == BOULDER) { + /* leaving boulder in liquid would trigger sanity_check warning */ + if (is_pool_or_lava(ox, oy)) + fracture_rock(otmp); + if (does_block(ox, oy, &levl[ox][oy])) + block_point(ox, oy); + } } /* note: if otmp is gone, billing for it was handled by useup() */