boolean window_inited; /* true if init_nhwindows() completed */
boolean vision_inited; /* true if vision is ready */
boolean sanity_check; /* run sanity checks */
+ boolean debug_overwrite_stairs; /* debug: allow overwriting stairs */
boolean debug_mongen; /* debug: prevent monster generation */
boolean debug_hunger; /* debug: prevent hunger */
boolean mon_polycontrol; /* debug: control monster polymorphs */
char *data;
};
+#define CAN_OVERWRITE_TERRAIN(ttyp) \
+ (iflags.debug_overwrite_stairs || !((ttyp) == LADDER || (ttyp) == STAIRS))
+
#define SET_TYPLIT(x, y, ttyp, llit) \
do { \
if ((x) >= 1 && (y) >= 0 && (x) < COLNO && (y) < ROWNO) { \
- if ((ttyp) < MAX_TYPE && levl[(x)][(y)].typ != STAIRS \
- && levl[(x)][(y)].typ != LADDER) \
+ if ((ttyp) < MAX_TYPE \
+ && CAN_OVERWRITE_TERRAIN(levl[(x)][(y)].typ)) \
levl[(x)][(y)].typ = (ttyp); \
if ((ttyp) == LAVAPOOL) \
levl[(x)][(y)].lit = 1; \
}
/* set debugging flags. debugging use only, of course. */
-/* nh.debug_flags({ mongen = false, hunger = false }); */
+/* nh.debug_flags({ mongen = false,
+ hunger = false,
+ overwrite_stairs = true }); */
static int
nhl_debug_flags(lua_State *L)
{
iflags.debug_hunger = !(boolean)val; /* value in lua is negated */
}
+ /* allow overwriting stairs */
+ val = get_table_boolean_opt(L, "overwrite_stairs", -1);
+ if (val != -1) {
+ iflags.debug_overwrite_stairs = (boolean)val;
+ }
+
return 0;
}
/* check for existing features */
oldtyp = levl[x][y].typ;
- if (oldtyp == STAIRS || oldtyp == LADDER)
+ if (!CAN_OVERWRITE_TERRAIN(oldtyp))
return;
amask = sp_amask_to_amask(a->sp_amask);
local number_pad = 0;
function initlev()
- nh.debug_flags({mongen = false, hunger = false });
+ nh.debug_flags({mongen = false, hunger = false, overwrite_stairs = true });
des.level_flags("noflip");
des.reset_level();
des.level_init({ style = "solidfill", fg = ".", lit = true });
des.teleport_region({ region = {POS.x,POS.y,POS.x,POS.y}, region_islev = true, dir="both" });
des.finalize_level();
+ for k, v in pairs(nh.stairways()) do
+ des.terrain(v.x - 1, v.y, ".");
+ end
end
function ctrl(key)