boolean vision_inited; /* true if vision is ready */
boolean sanity_check; /* run sanity checks */
boolean debug_mongen; /* debug: prevent monster generation */
+ boolean debug_hunger; /* debug: prevent hunger */
boolean mon_polycontrol; /* debug: control monster polymorphs */
boolean in_dumplog; /* doing the dumplog right now? */
boolean in_parse; /* is a command being parsed? */
static int nhl_stairways(lua_State *);
static int nhl_pushkey(lua_State *);
static int nhl_doturn(lua_State *);
-static int nhl_monster_generation(lua_State *);
+static int nhl_debug_flags(lua_State *);
static int nhl_test(lua_State *);
static int nhl_getmap(lua_State *);
static void nhl_add_table_entry_bool(lua_State *, const char *, boolean);
return 0;
}
-/* disable or enable monster generation. debugging use only. */
-/* disabling also kills all monsters on current level. */
-/* local prevvalue = nh.monster_generation(false); */
+/* set debugging flags. debugging use only, of course. */
+/* nh.debug_flags({ mongen = false, hunger = false }); */
static int
-nhl_monster_generation(lua_State *L)
+nhl_debug_flags(lua_State *L)
{
int argc = lua_gettop(L);
- boolean val = !iflags.debug_mongen; /* value in lua is negated */
+ int val;
- if (argc == 1) {
- iflags.debug_mongen = !lua_toboolean(L, 1);
+ int i;
+
+ lcheck_param_table(L);
+
+ /* disable monster generation */
+ val = get_table_boolean_opt(L, "mongen", -1);
+ if (val != -1) {
+ iflags.debug_mongen = !(boolean)val; /* value in lua is negated */
if (iflags.debug_mongen) {
register struct monst *mtmp, *mtmp2;
}
}
- lua_pushboolean(L, val);
- return 1;
+ /* prevent hunger */
+ val = get_table_boolean_opt(L, "hunger", -1);
+ if (val != -1) {
+ iflags.debug_hunger = !(boolean)val; /* value in lua is negated */
+ }
+
+ return 0;
}
{"stairways", nhl_stairways},
{"pushkey", nhl_pushkey},
{"doturn", nhl_doturn},
- {"monster_generation", nhl_monster_generation},
+ {"debug_flags", nhl_debug_flags},
{NULL, NULL}
};