digging in ice

If the spot in front of a closed drawbridge was ICE, digging there
had issues....
This commit is contained in:
PatR
2024-11-27 08:41:55 -08:00
parent c1c74db90c
commit 9c0e47785a
5 changed files with 64 additions and 33 deletions

View File

@@ -455,7 +455,7 @@ struct trap *
maketrap(coordxy x, coordxy y, int typ)
{
static union vlaunchinfo zero_vl;
boolean oldplace;
boolean oldplace, was_ice, clear_flags;
struct trap *ttmp;
struct rm *lev = &levl[x][y];
@@ -473,10 +473,10 @@ maketrap(coordxy x, coordxy y, int typ)
|| (u.utraptype == TT_LAVA && !is_lava(x, y))))
reset_utrap(FALSE);
/* old <tx,ty> remain valid */
} else if (!CAN_OVERWRITE_TERRAIN(lev->typ)
|| (IS_FURNITURE(lev->typ)
&& (typ != PIT && typ != HOLE))
} else if (!CAN_OVERWRITE_TERRAIN(lev->typ) /* stairs */
|| is_pool_or_lava(x, y)
|| (IS_FURNITURE(lev->typ) && (typ != PIT && typ != HOLE))
|| (lev->typ == DRAWBRIDGE_UP && typ == MAGIC_PORTAL)
|| (IS_AIR(lev->typ) && typ != MAGIC_PORTAL)
|| (typ == LEVEL_TELEP && single_level_branch(&u.uz))) {
/* no trap on top of furniture (caller usually screens the
@@ -522,22 +522,41 @@ maketrap(coordxy x, coordxy y, int typ)
&& (is_hole(typ) || IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
add_damage(x, y, /* schedule repair */
((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
&& !svc.context.mon_moving)
? SHOP_HOLE_COST
: 0L);
lev->doormask = 0; /* subsumes altarmask, icedpool... */
if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */
&& !svc.context.mon_moving) ? SHOP_HOLE_COST : 0L);
clear_flags = TRUE; /* assume lev->flags needs to be reset */
/* DRAWBRIDGE_UP passes the IS_ROOM() test so check it first;
it also needs to retain lev->drawbridgemask */
if (lev->typ == DRAWBRIDGE_UP) {
/* bridge is closed and we're putting a hole or pit at the span
spot; this trap will be deleted if/when the bridge is opened;
terrain becomes room floor even if it was moat, lava, or ice */
clear_flags = FALSE; /* keep lev->drawbridgemask */
was_ice = (lev->drawbridgemask & DB_UNDER) == DB_ICE;
lev->drawbridgemask &= ~DB_UNDER;
lev->drawbridgemask |= DB_FLOOR;
if (was_ice) {
/* subset of set_levltyp() after changing ice to floor;
frozen corpses resume rotting, no more ice to melt away */
obj_ice_effects(x, y, TRUE);
spot_stop_timers(x, y, MELT_ICE_AWAY);
}
} else if (IS_ROOM(lev->typ)) {
(void) set_levltyp(x, y, ROOM);
/*
* some cases which can happen when digging
* down while phazing thru solid areas
*/
else if (lev->typ == STONE || lev->typ == SCORR)
} else if (lev->typ == STONE || lev->typ == SCORR) {
(void) set_levltyp(x, y, CORR);
else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
} else if (IS_WALL(lev->typ) || lev->typ == SDOOR) {
(void) set_levltyp(x, y, svl.level.flags.is_maze_lev ? ROOM
: svl.level.flags.is_cavernous_lev ? CORR
: DOOR);
}
if (clear_flags)
lev->flags = 0; /* set_levltyp doesn't take care of this [yet?] */
unearth_objs(x, y);
break;