From 592e00b98126fe774604e277e948d08b5b91d28d Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 17 Oct 2021 08:20:50 -0400 Subject: [PATCH] melting ice follow-up --- src/dig.c | 12 ++++++++---- src/hack.c | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/dig.c b/src/dig.c index 46d3c3b85..2134bc84c 100644 --- a/src/dig.c +++ b/src/dig.c @@ -769,7 +769,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) struct obj *boulder_here; schar typ, old_typ; xchar dig_x, dig_y; - boolean nohole, retval = TRUE; + boolean nohole, retval = FALSE; if (!cc) { dig_x = u.ux; @@ -805,12 +805,12 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) closed "door" where the portcullis/mechanism is located */ if (pit_only) { pline_The("drawbridge seems too hard to dig through."); - retval = FALSE; } else { int x = dig_x, y = dig_y; /* if under the portcullis, the bridge is adjacent */ (void) find_drawbridge(&x, &y); destroy_drawbridge(x, y); + retval = TRUE; } } else if ((boulder_here = sobj_at(BOULDER, dig_x, dig_y)) != 0) { @@ -831,6 +831,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) } else if (IS_GRAVE(old_typ)) { digactualhole(dig_x, dig_y, BY_YOU, PIT); dig_up_grave(cc); + retval = TRUE; } else if (old_typ == DRAWBRIDGE_UP) { /* must be floor or ice, other cases handled above */ /* dig "pit" and let fluid flow in (if possible) */ @@ -844,12 +845,12 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y), (dig_x != u.ux || dig_y != u.uy) ? "t" : ""); - retval = FALSE; } else { lev->drawbridgemask &= ~DB_UNDER; lev->drawbridgemask |= (typ == LAVAPOOL) ? DB_LAVA : DB_MOAT; liquid_flow(dig_x, dig_y, typ, ttmp, "As you dig, the hole fills with %s!"); + retval = TRUE; } /* the following two are here for the wand of digging */ @@ -869,6 +870,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) liquid_flow(dig_x, dig_y, typ, ttmp, "As you dig, the hole fills with %s!"); } + retval = TRUE; } else { /* magical digging disarms settable traps */ if (by_magic && ttmp @@ -884,9 +886,11 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) digactualhole(dig_x, dig_y, BY_YOU, PIT); else digactualhole(dig_x, dig_y, BY_YOU, HOLE); + retval = TRUE; } } - spot_checks(dig_x, dig_y, old_typ); + if (retval) + spot_checks(dig_x, dig_y, old_typ); return retval; } diff --git a/src/hack.c b/src/hack.c index 5fd152c91..207b4740b 100644 --- a/src/hack.c +++ b/src/hack.c @@ -3441,7 +3441,8 @@ spot_checks(xchar x, xchar y, schar old_typ) db_ice_now = ((levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE); /*FALLTHRU*/ case ICE: - if ((new_typ != old_typ) || !db_ice_now) { + if ((new_typ != old_typ) + || (old_typ == DRAWBRIDGE_UP && !db_ice_now)) { /* make sure there's no MELT_ICE_AWAY timer */ if (spot_time_left(x, y, MELT_ICE_AWAY)) { spot_stop_timers(x, y, MELT_ICE_AWAY);