int prop;
{
register xchar x, y;
- /* struct rm *lev; */ /* REVIEW: unreferenced */
x1 = max(x1, 1);
x2 = min(x2, COLNO - 1);
lua_State *L;
{
char *s = get_table_str_opt(L, "id", NULL);
- int ret = NON_PM /*, i */ /* REVIEW: unreferenced */;
+ int ret = NON_PM;
if (s) {
ret = find_montype(L, s);
long ecoord;
const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL };
const int engrtypes2i[] = { DUST, ENGRAVE, BURN, MARK, ENGR_BLOOD, 0 };
- xchar x, y;
+ xchar x = -1, y = -1;
int argc = lua_gettop(L);
- x = y = 0; /* FIXME: quiet a warning for else clause below.
- should it actually be -1? */
create_des_coder();
if (argc == 1) {
txt = dupstr(luaL_checkstring(L, 3));
} else {
nhl_error(L, "Wrong parameters");
- /* FIXME: this clause left etyp uninitialized so initialization
- to DUST was added above to quiet a macosx warning */
}
if (x == -1 && y == -1)
const int stairdirs2i[] = { 0, 1 };
long scoord;
- int ax = -1, ay = -1; /* FIXME: initializers added, macosx warning */
+ int ax = -1, ay = -1;
int up;
int ltype = lua_type(L, 1);
{ "anti magic", ANTI_MAGIC },
{ "polymorph", POLY_TRAP },
{ "vibrating square", VIBRATING_SQUARE },
- { 0, 0 } };
+ { "random", -1 },
+ { 0, NO_TRAP } };
int
get_table_traptype_opt(L, name, defval)
return defval;
}
+int
+get_traptype_byname(trapname)
+char *trapname;
+{
+ int i;
+
+ for (i = 0; trap_types[i].name; i++)
+ if (!strcmpi(trapname, trap_types[i].name))
+ return trap_types[i].type;
+
+ return NO_TRAP;
+}
+
/* trap({ type = "hole", x = 1, y = 1 }); */
/* trap("hole", 3, 4); */
/* trap("level teleport", {5, 8}); */
{
spltrap tmptrap;
int x, y;
- /* long tcoord; */ /* REVIEW: unreferenced */
int argc = lua_gettop(L);
create_des_coder();
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
const char *trapstr = luaL_checkstring(L, 1);
- int i;
- tmptrap.type = -1;
- for (i = 0; trap_types[i].name; i++)
- if (!strcmpi(trapstr, trap_types[i].name)) {
- tmptrap.type = trap_types[i].type;
- break;
- }
+ tmptrap.type = get_traptype_byname(trapstr);
x = y = -1;
} else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING
&& lua_type(L, 2) == LUA_TTABLE) {
const char *trapstr = luaL_checkstring(L, 1);
- int i;
- tmptrap.type = -1;
- for (i = 0; trap_types[i].name; i++)
- if (!strcmpi(trapstr, trap_types[i].name)) {
- tmptrap.type = trap_types[i].type;
- break;
- }
+ tmptrap.type = get_traptype_byname(trapstr);
get_coord(L, 2, &x, &y);
} else if (argc == 3) {
const char *trapstr = luaL_checkstring(L, 1);
- int i;
- tmptrap.type = -1;
- for (i = 0; trap_types[i].name; i++)
- if (!strcmpi(trapstr, trap_types[i].name)) {
- tmptrap.type = trap_types[i].type;
- break;
- }
+
+ tmptrap.type = get_traptype_byname(trapstr);
x = luaL_checkinteger(L, 2);
y = luaL_checkinteger(L, 3);
-
- if (tmptrap.type == -1)
- nhl_error(L, "Unknown trap type");
-
} else {
lcheck_param_table(L);
}
}
+ if (tmptrap.type == NO_TRAP)
+ nhl_error(L, "Unknown trap type");
+
if (x == -1 && y == -1)
tmptrap.coord = SP_COORD_PACK_RANDOM(0);
else
{
terrain tmpterrain;
xchar x, y;
- /* char *ter; */ /* REVIEW: unreferenced */
struct selectionvar *sel = NULL;
int argc = lua_gettop(L);
create_des_coder();
+ tmpterrain.tlit = 0;
+ tmpterrain.ter = INVALID_TYPE;
if (argc == 1) {
lcheck_param_table(L);
} else if (argc == 2) {
sel = l_selection_check(L, 1);
tmpterrain.ter = check_mapchr(luaL_checkstring(L, 2));
- tmpterrain.tlit = luaL_optinteger(L, 3, 0); /* FIXME: this can never be here, argc==2 */
} else if (argc == 3) {
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
tmpterrain.ter = check_mapchr(luaL_checkstring(L, 3));
- tmpterrain.tlit = 0;
} else {
nhl_error(L, "wrong parameters");
}
lua_State *L;
{
replaceterrain rt;
- /* char *toter, *fromter; */ /* REVIEW: unreferenced */
xchar totyp, fromtyp;
create_des_coder();
int *x1, *y1, *x2, *y2;
boolean optional;
{
- int arrlen /*, i*/ /* REVIEW: unreferenced */;
- /* int retvals[4]; */ /* REVIEW: unreferenced */
+ int arrlen;
lua_getfield(L, 1, name);
if (optional && lua_type(L, -1) == LUA_TNIL) {
const char *const dbopens[] = { "open", "closed", "random", NULL };
const int dbopens2i[] = { 1, 0, -1, -2 };
xchar x, y;
-/* int dbopen; */
int mx, my, dir;
int db_open;
long dcoord;
y = my;
get_location_coord(&x, &y, DRY | WET | HOT, g.coder->croom, dcoord);
- /* REVIEW: from here down was using dbopen previously */
if (db_open == -1)
db_open = !rn2(2);
if (!create_drawbridge(x, y, dir, db_open ? TRUE : FALSE))
int argc = lua_gettop(L);
boolean freesel = FALSE;
struct selectionvar *sel = (struct selectionvar *) 0;
- /* REVIEW: compiler warning,
- all assignments conditional
- so initializer was added */
create_des_coder();
int argc = lua_gettop(L);
boolean freesel = FALSE;
struct selectionvar *sel = (struct selectionvar *) 0;
- /* REVIEW: compiler warning,
- all assignments conditional
- so initializer was added */
create_des_coder();
/* reset_level is only needed for testing purposes */
int
lspo_reset_level(L)
-lua_State *L UNUSED; /* macosx complaint needed UNUSED */
+lua_State *L UNUSED;
{
boolean wtower = In_W_tower(u.ux, u.uy, &u.uz);
create_des_coder();
makemap_prepost(TRUE, wtower);
clear_level_structures();
- return 0; /* REVIEW: warning, int fn must return value
- so added "return 0; " */
+ return 0;
}
/* map({ x = 10, y = 10, map = [[...]] }); */
lua_State *L;
{
mazepart tmpmazepart;
- /* xchar halign, valign; */ /* REVIEW: unreferenced */
xchar tmpxstart, tmpystart, tmpxsize, tmpysize;
- /* unpacked_coord upc; */ /* REVIEW: unreferenced */
/*
TODO: allow passing an array of strings as map data