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

View File

@@ -3430,4 +3430,26 @@ money_cnt(struct obj *otmp)
return 0L;
}
void
spot_checks(xchar x, xchar y, schar old_typ)
{
schar new_typ = levl[x][y].typ;
boolean db_ice_now = FALSE;
switch (old_typ) {
case DRAWBRIDGE_UP:
db_ice_now = ((levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE);
/*FALLTHRU*/
case ICE:
if ((new_typ != old_typ) || !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);
}
/* adjust things affected by the ice */
obj_ice_effects(x, y, FALSE);
}
break;
}
}
/*hack.c*/