From 7ce0751a6c9fb2575bb02485a4241934e8e7b40d Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 19 Jan 2025 18:56:59 +0200 Subject: [PATCH] Fix breaking wand of digging and boulders next to lava If one or more boulders were next to lava and hero broke a wand of digging next to that location, the boulder(s) stayed over the lava causing a sanity checking error. --- src/apply.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/apply.c b/src/apply.c index 1de989ac3..376f41b2c 100644 --- a/src/apply.c +++ b/src/apply.c @@ -42,6 +42,7 @@ staticfn void display_grapple_positions(boolean); staticfn int use_grapple(struct obj *); staticfn void discard_broken_wand(void); staticfn void broken_wand_explode(struct obj *, int, int); +staticfn void maybe_dunk_boulders(coordxy, coordxy); staticfn int do_break_wand(struct obj *); staticfn int apply_ok(struct obj *); staticfn int flip_through_book(struct obj *); @@ -3854,6 +3855,18 @@ broken_wand_explode(struct obj *obj, int dmg, int expltype) discard_broken_wand(); } +/* if x,y has lava or water, dunk any boulders at that location into it */ +staticfn void +maybe_dunk_boulders(coordxy x, coordxy y) +{ + struct obj *otmp; + + while (is_pool_or_lava(x, y) && (otmp = sobj_at(BOULDER, x, y)) != 0) { + obj_extract_self(otmp); + (void) boulder_hits_pool(otmp, x,y, FALSE); + } +} + /* return 1 if the wand is broken, hence some time elapsed */ staticfn int do_break_wand(struct obj *obj) @@ -4022,6 +4035,8 @@ do_break_wand(struct obj *obj) } } fill_pit(x, y); + maybe_dunk_boulders(x, y); + recalc_block_point(x, y); continue; } else if (obj->otyp == WAN_CREATE_MONSTER) { /* u.ux,u.uy creates it near you--x,y might create it in rock */