melting ice timeout issues

Reported directly to devteam by entrez via email:
>
> I noticed some potential issues with (melting) ice:
>
>   * Digging down into ice, or setting a land mine on the ice and
>   triggering it, doesn't remove the melt_ice timeout, so it can result
>   in a sequence like dig down -> pit fills with water -> freeze water
>   -> freezing water tries to set melt_ice timeout -> duplicate timeout
>   impossible.  Or if you don't freeze the water again, melt_ice will
>   run on a non-ice surface, which might at least produce strange
>   messages.
>
>   * Setting a land mine on ice: melting ice doesn't do anything with
>   the trap, so there is still a land mine which you can trigger by
>   flying over the water (the land mine's trigger is also still
>   described as being 'in a pile of soil', despite being underwater at
>   this point).  Similar thing happens with bear traps.
>
>   * Not really related to _melting_ ice, but an exploding land mine
>   doesn't reset the typ from ICE to FLOOR (like normal digging does),
>   so it will result in a square with a pit that is also an ice square,
>   where the ice can melt under the pit and produce a combination
>   pit/moat.  If you then freeze the moat, the pit reappears on top of
>   the ice.
This commit is contained in:
nhmall
2021-10-16 22:22:33 -04:00
parent 91b4e4570d
commit 17165e3b92
7 changed files with 94 additions and 42 deletions
+19 -1
View File
@@ -2570,8 +2570,9 @@ blow_up_landmine(struct trap* trap)
{
int x = trap->tx, y = trap->ty, dbx, dby;
struct rm *lev = &levl[x][y];
schar typ;
schar old_typ, typ;
old_typ = lev->typ;
(void) scatter(x, y, 4,
MAY_DESTROY | MAY_HIT | MAY_FRACTURE | VIS_EFFECTS,
(struct obj *) 0);
@@ -2607,6 +2608,7 @@ blow_up_landmine(struct trap* trap)
}
}
}
spot_checks(x, y, old_typ);
}
static void
@@ -5996,4 +5998,20 @@ ignite_items(struct obj* objchn)
}
}
void
trap_ice_effects(xchar x, xchar y, boolean ice_is_melting)
{
struct trap *ttmp = t_at(x, y);
if (ttmp && ice_is_melting) {
if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) {
/* landmine or bear trap set on top of the ice falls
into the water */
int otyp = (ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP;
cnv_trap_obj(otyp, 1, ttmp, TRUE);
} else {
deltrap(ttmp);
}
}
}
/*trap.c*/