]> granicus.if.org Git - nethack/commitdiff
Remove melting ice timeouts when terrain changes
authorPasi Kallinen <paxed@alt.org>
Wed, 16 Mar 2022 14:51:53 +0000 (16:51 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 16 Mar 2022 14:51:53 +0000 (16:51 +0200)
If special level lua code creates a melting ice timeout, but
later in the code places stairs, or a trap which might change
the ice to room floor, the timer sanity checking doesn't
like that.

src/mklev.c
src/trap.c

index 3e387bd9614d8a6dff72804fe187fff16ae360ab..015bc94ffef0d085ee4425cd4705203179de4437 100644 (file)
@@ -1635,6 +1635,9 @@ mkstairs(xchar x, xchar y,
     dest.dlevel = u.uz.dlevel + (up ? -1 : 1);
     stairway_add(x, y, up ? TRUE : FALSE, FALSE, &dest);
 
+    if (levl[x][y].typ == ICE)
+        spot_stop_timers(x, y, MELT_ICE_AWAY);
+
     levl[x][y].typ = STAIRS;
     levl[x][y].ladder = up ? LA_UP : LA_DOWN;
 }
index b49b6b83ce42283a4c9e343c02b4ed82465bd9f4..8290af0a8c4195dda1989de15c8939009efaf4e4 100644 (file)
@@ -348,6 +348,7 @@ maketrap(int x, int y, int typ)
     boolean oldplace;
     struct trap *ttmp;
     struct rm *lev = &levl[x][y];
+    boolean was_ice = (lev->typ == ICE);
 
     if ((ttmp = t_at(x, y)) != 0) {
         if (undestroyable_trap(ttmp->ttyp))
@@ -459,6 +460,8 @@ maketrap(int x, int y, int typ)
                          : DOOR;
 
         unearth_objs(x, y);
+        if (was_ice && lev->typ != ICE)
+            spot_stop_timers(x, y, MELT_ICE_AWAY);
         break;
     }