quiet some macosx warnings

This commit is contained in:
nhmall
2019-11-15 21:20:38 -05:00
parent f319a8ce3f
commit 298af2294f
7 changed files with 133 additions and 55 deletions
Regular → Executable
+3
View File
@@ -339,6 +339,9 @@ E const struct c_common_strings c_common_strings;
/* material strings */ /* material strings */
E const char *materialnm[]; E const char *materialnm[];
/* empty string that is non-const for parameter use */
E char emptystr[];
/* Monster name articles */ /* Monster name articles */
#define ARTICLE_NONE 0 #define ARTICLE_NONE 0
#define ARTICLE_THE 1 #define ARTICLE_THE 1
Regular → Executable
+6
View File
@@ -573,4 +573,10 @@ E int FDECL(atoi, (const char *));
#include "lualib.h" #include "lualib.h"
#include "lauxlib.h" #include "lauxlib.h"
#if defined(WIN32)
#define LUA_INTCAST(i) ((int) i)
#else
#define LUA_INTCAST(i) (i)
#endif
#endif /* SYSTEM_H */ #endif /* SYSTEM_H */
Regular → Executable
+2
View File
@@ -108,6 +108,8 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
"platinum", "mithril", "plastic", "glass", "platinum", "mithril", "plastic", "glass",
"gemstone", "stone" }; "gemstone", "stone" };
char emptystr[] = {0}; /* non-const */
/* Global windowing data, defined here for multi-window-system support */ /* Global windowing data, defined here for multi-window-system support */
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN; NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
#ifdef WIN32 #ifdef WIN32
Regular → Executable
+27 -15
View File
@@ -35,7 +35,9 @@ struct lchoice {
char menuletter; char menuletter;
}; };
#if 0
static void FDECL(Fread, (genericptr_t, int, int, dlb *)); static void FDECL(Fread, (genericptr_t, int, int, dlb *));
#endif
static xchar FDECL(dname_to_dnum, (const char *)); static xchar FDECL(dname_to_dnum, (const char *));
static int FDECL(find_branch, (const char *, struct proto_dungeon *)); static int FDECL(find_branch, (const char *, struct proto_dungeon *));
static xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); static xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *));
@@ -293,6 +295,7 @@ NHFILE *nhfp;
} }
} }
#if 0
static void static void
Fread(ptr, size, nitems, stream) Fread(ptr, size, nitems, stream)
genericptr_t ptr; genericptr_t ptr;
@@ -308,6 +311,7 @@ dlb *stream;
nh_terminate(EXIT_FAILURE); nh_terminate(EXIT_FAILURE);
} }
} }
#endif
static xchar static xchar
dname_to_dnum(s) dname_to_dnum(s)
@@ -776,7 +780,7 @@ lua_State *L;
if (lua_type(L, -1) == LUA_TTABLE) { if (lua_type(L, -1) == LUA_TTABLE) {
int f, nflags; int f, nflags;
lua_len(L, -1); lua_len(L, -1);
nflags = lua_tointeger(L, -1); nflags = LUA_INTCAST(lua_tointeger(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
for (f = 0; f < nflags; f++) { for (f = 0; f < nflags; f++) {
lua_pushinteger(L, f+1); lua_pushinteger(L, f+1);
@@ -807,7 +811,9 @@ init_dungeons()
register s_level *x; register s_level *x;
struct proto_dungeon pd; struct proto_dungeon pd;
struct level_map *lev_map; struct level_map *lev_map;
int tidx;
nhUse(cb);
(void) memset(&pd, 0, sizeof(struct proto_dungeon)); (void) memset(&pd, 0, sizeof(struct proto_dungeon));
pd.n_levs = pd.n_brs = 0; pd.n_levs = pd.n_brs = 0;
@@ -850,7 +856,7 @@ init_dungeons()
panic("dungeon is not a lua table"); panic("dungeon is not a lua table");
lua_len(L, -1); lua_len(L, -1);
g.n_dgns = lua_tointeger(L, -1); g.n_dgns = LUA_INTCAST(lua_tointeger(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
pd.start = 0; pd.start = 0;
@@ -865,23 +871,26 @@ init_dungeons()
if (g.n_dgns >= MAXDUNGEON) if (g.n_dgns >= MAXDUNGEON)
panic("init_dungeons: too many dungeons"); panic("init_dungeons: too many dungeons");
int tidx = lua_gettop(L); tidx = lua_gettop(L);
lua_pushnil(L); /* first key */ lua_pushnil(L); /* first key */
i = 0; i = 0;
while (lua_next(L, tidx) != 0) { while (lua_next(L, tidx) != 0) {
char *dgn_name, *dgn_bonetag, *dgn_protoname;
int dgn_base, dgn_range, dgn_align, dgn_entry, dgn_chance, dgn_flags;
if (!lua_istable(L, -1)) if (!lua_istable(L, -1))
panic("dungeon[%i] is not a lua table", i); panic("dungeon[%i] is not a lua table", i);
char *dgn_name = get_table_str(L, "name"); dgn_name = get_table_str(L, "name");
char *dgn_bonetag = get_table_str_opt(L, "bonetag", ""); /* TODO: single char or "none" */ dgn_bonetag = get_table_str_opt(L, "bonetag", emptystr); /* TODO: single char or "none" */
char *dgn_protoname = get_table_str_opt(L, "protofile", ""); dgn_protoname = get_table_str_opt(L, "protofile", emptystr);
int dgn_base = get_table_int(L, "base"); dgn_base = get_table_int(L, "base");
int dgn_range = get_table_int_opt(L, "range", 0); dgn_range = get_table_int_opt(L, "range", 0);
int dgn_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)]; dgn_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)];
int dgn_entry = get_table_int_opt(L, "entry", 0); dgn_entry = get_table_int_opt(L, "entry", 0);
int dgn_chance = get_table_int_opt(L, "chance", 100); dgn_chance = get_table_int_opt(L, "chance", 100);
int dgn_flags = get_dgn_flags(L); dgn_flags = get_dgn_flags(L);
debugpline4("DUNGEON[%i]: %s, base=(%i,%i)", i, dgn_name, dgn_base, dgn_range); debugpline4("DUNGEON[%i]: %s, base=(%i,%i)", i, dgn_name, dgn_base, dgn_range);
@@ -897,7 +906,7 @@ init_dungeons()
if (lua_type(L, -1) == LUA_TTABLE) { if (lua_type(L, -1) == LUA_TTABLE) {
int f, nlevels; int f, nlevels;
lua_len(L, -1); lua_len(L, -1);
nlevels = lua_tointeger(L, -1); nlevels = LUA_INTCAST(lua_tointeger(L, -1));
pd.tmpdungeon[i].levels = nlevels; pd.tmpdungeon[i].levels = nlevels;
lua_pop(L, 1); lua_pop(L, 1);
for (f = 0; f < nlevels; f++) { for (f = 0; f < nlevels; f++) {
@@ -906,7 +915,7 @@ init_dungeons()
if (lua_type(L, -1) == LUA_TTABLE) { if (lua_type(L, -1) == LUA_TTABLE) {
int bi; int bi;
char *lvl_name = get_table_str(L, "name"); char *lvl_name = get_table_str(L, "name");
char *lvl_bonetag = get_table_str_opt(L, "bonetag", ""); char *lvl_bonetag = get_table_str_opt(L, "bonetag", emptystr);
int lvl_base = get_table_int(L, "base"); int lvl_base = get_table_int(L, "base");
int lvl_range = get_table_int_opt(L, "range", 0); int lvl_range = get_table_int_opt(L, "range", 0);
int lvl_nlevels = get_table_int_opt(L, "nlevels", 0); int lvl_nlevels = get_table_int_opt(L, "nlevels", 0);
@@ -915,6 +924,9 @@ init_dungeons()
int lvl_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)]; int lvl_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)];
int lvl_flags = get_dgn_flags(L); int lvl_flags = get_dgn_flags(L);
struct tmplevel *tmpl = &pd.tmplevel[pd.n_levs + f]; struct tmplevel *tmpl = &pd.tmplevel[pd.n_levs + f];
nhUse(lvl_bonetag);
nhUse(lvl_align);
debugpline4("LEVEL[%i]:%s,(%i,%i)", f, lvl_name, lvl_base, lvl_range); debugpline4("LEVEL[%i]:%s,(%i,%i)", f, lvl_name, lvl_base, lvl_range);
tmpl->name = lvl_name; tmpl->name = lvl_name;
tmpl->chainlvl = lvl_chain; tmpl->chainlvl = lvl_chain;
@@ -953,7 +965,7 @@ init_dungeons()
if (lua_type(L, -1) == LUA_TTABLE) { if (lua_type(L, -1) == LUA_TTABLE) {
int f, nbranches; int f, nbranches;
lua_len(L, -1); lua_len(L, -1);
nbranches = lua_tointeger(L, -1); nbranches = LUA_INTCAST(lua_tointeger(L, -1));
pd.tmpdungeon[i].branches = nbranches; pd.tmpdungeon[i].branches = nbranches;
lua_pop(L, 1); lua_pop(L, 1);
for (f = 0; f < nbranches; f++) { for (f = 0; f < nbranches; f++) {
Regular → Executable
+34 -2
View File
@@ -23,17 +23,27 @@ static int FDECL(l_selection_filter_mapchar, (lua_State *));
static int FDECL(l_selection_flood, (lua_State *)); static int FDECL(l_selection_flood, (lua_State *));
static int FDECL(l_selection_circle, (lua_State *)); static int FDECL(l_selection_circle, (lua_State *));
static int FDECL(l_selection_ellipse, (lua_State *)); static int FDECL(l_selection_ellipse, (lua_State *));
static int FDECL(l_selection_gradient, (lua_State *));
static int FDECL(l_selection_iterate, (lua_State *));
static int FDECL(l_selection_gc, (lua_State *)); static int FDECL(l_selection_gc, (lua_State *));
static int FDECL(l_selection_not, (lua_State *)); static int FDECL(l_selection_not, (lua_State *));
static int FDECL(l_selection_and, (lua_State *)); static int FDECL(l_selection_and, (lua_State *));
static int FDECL(l_selection_or, (lua_State *)); static int FDECL(l_selection_or, (lua_State *));
static int FDECL(l_selection_xor, (lua_State *)); static int FDECL(l_selection_xor, (lua_State *));
static int FDECL(l_selection_not, (lua_State *)); static int FDECL(l_selection_not, (lua_State *));
#if 0
/* the following do not appear to currently be
used and because they are static, the OSX
compiler is complaining about them. I've
if ifdef'd out the prototype here and the
function body below.
*/
static int FDECL(l_selection_gradient, (lua_State *));
static int FDECL(l_selection_iterate, (lua_State *));
static int FDECL(l_selection_add, (lua_State *)); static int FDECL(l_selection_add, (lua_State *));
static int FDECL(l_selection_sub, (lua_State *)); static int FDECL(l_selection_sub, (lua_State *));
static int FDECL(l_selection_ipairs, (lua_State *)); static int FDECL(l_selection_ipairs, (lua_State *));
/* this prototype was missing but function body was below */
static struct selectionvar *FDECL(l_selection_to, (lua_State *, int));
#endif
struct selectionvar * struct selectionvar *
l_selection_check(L, index) l_selection_check(L, index)
@@ -588,6 +598,17 @@ lua_State *L;
filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */
} else { } else {
nhl_error(L, "wrong parameters"); nhl_error(L, "wrong parameters");
/*
* FIXME: OSX compiler is issuing a complaint
* about r being passed to selection_do_ellipse()
* below without ever having been initialized
* to something when this else clause is encountered.
* I could have added an initializer to r at the
* top, but I didn't know what it should be initialized
* to in order for selection_do_ellipse() to not
* misbehave. The parameters passed in previous versions
* were related to xaxis and yaxis.
*/
} }
get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x,y)); get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x,y));
@@ -639,6 +660,17 @@ lua_State *L;
filled = (int) luaL_optinteger(L, 6, 0); /* TODO: boolean */ filled = (int) luaL_optinteger(L, 6, 0); /* TODO: boolean */
} else { } else {
nhl_error(L, "wrong parameters"); nhl_error(L, "wrong parameters");
/*
* FIXME: OSX compiler is issuing a complaint
* about r1 and r2 being passed to selection_do_ellipse()
* below without ever having been initialized
* to something when this else clause is encountered.
* I could have added an initializer to r1,r2 at the
* top, but I didn't know what they should be initialized
* to in order for selection_do_ellipse() to not
* misbehave. The parameters passed in previous versions
* were related to xaxis and yaxis.
*/
} }
get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x,y)); get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x,y));
Regular → Executable
+16 -8
View File
@@ -16,7 +16,9 @@
/* lua_CFunction prototypes */ /* lua_CFunction prototypes */
static int FDECL(nhl_test, (lua_State *)); static int FDECL(nhl_test, (lua_State *));
static int FDECL(nhl_getmap, (lua_State *)); static int FDECL(nhl_getmap, (lua_State *));
#if 0
static int FDECL(nhl_setmap, (lua_State *)); static int FDECL(nhl_setmap, (lua_State *));
#endif
static int FDECL(nhl_pline, (lua_State *)); static int FDECL(nhl_pline, (lua_State *));
static int FDECL(nhl_verbalize, (lua_State *)); static int FDECL(nhl_verbalize, (lua_State *));
static int FDECL(nhl_menu, (lua_State *)); static int FDECL(nhl_menu, (lua_State *));
@@ -87,7 +89,7 @@ schar defval;
char *ter; char *ter;
xchar typ; xchar typ;
ter = get_table_str_opt(L, name, ""); ter = get_table_str_opt(L, name, emptystr);
if (name && *ter) { if (name && *ter) {
typ = check_mapchr(ter); typ = check_mapchr(ter);
if (typ == INVALID_TYPE) if (typ == INVALID_TYPE)
@@ -213,8 +215,8 @@ lua_State *L;
int argc = lua_gettop(L); int argc = lua_gettop(L);
if (argc == 2) { if (argc == 2) {
int x = lua_tointeger(L, 1); int x = LUA_INTCAST(lua_tointeger(L, 1));
int y = lua_tointeger(L, 2); int y = LUA_INTCAST(lua_tointeger(L, 2));
if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) { if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -572,7 +574,9 @@ const char *name;
if (ltyp == LUA_TSTRING) { if (ltyp == LUA_TSTRING) {
const char *const boolstr[] = { "true", "false", "yes", "no", NULL }; const char *const boolstr[] = { "true", "false", "yes", "no", NULL };
const int boolstr2i[] = { TRUE, FALSE, TRUE, FALSE, -1 }; const int boolstr2i[] = { TRUE, FALSE, TRUE, FALSE, -1 };
ret = luaL_checkoption(L, -1, NULL, boolstr); ret = luaL_checkoption(L, -1, NULL, boolstr);
nhUse(boolstr2i[0]);
} else if (ltyp == LUA_TBOOLEAN) { } else if (ltyp == LUA_TBOOLEAN) {
ret = lua_toboolean(L, -1); ret = lua_toboolean(L, -1);
} else if (ltyp == LUA_TNUMBER) { } else if (ltyp == LUA_TNUMBER) {
@@ -625,14 +629,17 @@ static int
nhl_test(L) nhl_test(L)
lua_State *L; lua_State *L;
{ {
int x, y;
char *name, Player[] = "Player";
/* discard any extra arguments passed in */ /* discard any extra arguments passed in */
lua_settop(L, 1); lua_settop(L, 1);
luaL_checktype(L, 1, LUA_TTABLE); luaL_checktype(L, 1, LUA_TTABLE);
int x = get_table_int(L, "x"); x = get_table_int(L, "x");
int y = get_table_int(L, "y"); y = get_table_int(L, "y");
char *name = get_table_str_opt(L, "name", "Player"); name = get_table_str_opt(L, "name", Player);
pline("TEST:{ x=%i, y=%i, name=\"%s\" }", x,y, name); pline("TEST:{ x=%i, y=%i, name=\"%s\" }", x,y, name);
@@ -645,8 +652,9 @@ static const struct luaL_Reg nhl_functions[] = {
{"test", nhl_test}, {"test", nhl_test},
{"getmap", nhl_getmap}, {"getmap", nhl_getmap},
/*{"setmap", nhl_setmap},*/ #if 0
{"setmap", nhl_setmap},
#endif
{"pline", nhl_pline}, {"pline", nhl_pline},
{"verbalize", nhl_verbalize}, {"verbalize", nhl_verbalize},
{"menu", nhl_menu}, {"menu", nhl_menu},
Regular → Executable
+45 -30
View File
@@ -64,17 +64,13 @@ static void FDECL(wallify_map, (int, int, int, int));
static void FDECL(maze1xy, (coord *, int)); static void FDECL(maze1xy, (coord *, int));
static void NDECL(fill_empty_maze); static void NDECL(fill_empty_maze);
static void FDECL(splev_initlev, (lev_init *)); static void FDECL(splev_initlev, (lev_init *));
#if 0
/* macosx complains that these are unused */
static long FDECL(sp_code_jmpaddr, (long, long)); static long FDECL(sp_code_jmpaddr, (long, long));
static void NDECL(spo_end_moninvent);
static void NDECL(spo_pop_container);
static void FDECL(spo_room, (struct sp_coder *)); static void FDECL(spo_room, (struct sp_coder *));
static void FDECL(spo_endroom, (struct sp_coder *));
static void FDECL(spo_trap, (struct sp_coder *)); static void FDECL(spo_trap, (struct sp_coder *));
static void FDECL(spo_gold, (struct sp_coder *)); static void FDECL(spo_gold, (struct sp_coder *));
static void FDECL(spo_corridor, (struct sp_coder *)); static void FDECL(spo_corridor, (struct sp_coder *));
static void FDECL(sel_set_ter, (int, int, genericptr_t));
static void FDECL(sel_set_feature, (int, int, genericptr_t));
static void FDECL(sel_set_door, (int, int, genericptr_t));
static void FDECL(spo_feature, (struct sp_coder *)); static void FDECL(spo_feature, (struct sp_coder *));
static void FDECL(spo_terrain, (struct sp_coder *)); static void FDECL(spo_terrain, (struct sp_coder *));
static void FDECL(spo_replace_terrain, (struct sp_coder *)); static void FDECL(spo_replace_terrain, (struct sp_coder *));
@@ -84,8 +80,15 @@ static void FDECL(spo_drawbridge, (struct sp_coder *));
static void FDECL(spo_mazewalk, (struct sp_coder *)); static void FDECL(spo_mazewalk, (struct sp_coder *));
static void FDECL(spo_wall_property, (struct sp_coder *)); static void FDECL(spo_wall_property, (struct sp_coder *));
static void FDECL(spo_room_door, (struct sp_coder *)); static void FDECL(spo_room_door, (struct sp_coder *));
static void FDECL(sel_set_wallify, (int, int, genericptr_t));
static void FDECL(spo_wallify, (struct sp_coder *)); static void FDECL(spo_wallify, (struct sp_coder *));
static void FDECL(sel_set_wallify, (int, int, genericptr_t));
#endif
static void NDECL(spo_end_moninvent);
static void NDECL(spo_pop_container);
static void FDECL(spo_endroom, (struct sp_coder *));
static void FDECL(sel_set_ter, (int, int, genericptr_t));
static void FDECL(sel_set_door, (int, int, genericptr_t));
static void FDECL(sel_set_feature, (int, int, genericptr_t));
static int FDECL(get_coord, (lua_State *, int, int *, int *)); static int FDECL(get_coord, (lua_State *, int, int *, int *));
static int FDECL(get_table_region, (lua_State *, const char *, int *, int *, int *, int *, BOOLEAN_P)); static int FDECL(get_table_region, (lua_State *, const char *, int *, int *, int *, int *, BOOLEAN_P));
@@ -2247,13 +2250,14 @@ lev_init *linit;
} }
} }
#if 0
static long static long
sp_code_jmpaddr(curpos, jmpaddr) sp_code_jmpaddr(curpos, jmpaddr)
long curpos, jmpaddr; long curpos, jmpaddr;
{ {
return (curpos + jmpaddr); return (curpos + jmpaddr);
} }
#endif
/*ARGUSED*/ /*ARGUSED*/
@@ -2282,6 +2286,7 @@ lua_State *L;
{ {
char *levmsg; char *levmsg;
int old_n, n; int old_n, n;
const char *msg;
int argc = lua_gettop(L); int argc = lua_gettop(L);
@@ -2292,7 +2297,7 @@ lua_State *L;
create_des_coder(); create_des_coder();
const char *msg = luaL_checkstring(L, 1); msg = luaL_checkstring(L, 1);
old_n = g.lev_message ? (strlen(g.lev_message) + 1) : 0; old_n = g.lev_message ? (strlen(g.lev_message) + 1) : 0;
n = strlen(msg); n = strlen(msg);
@@ -2315,10 +2320,10 @@ int
get_table_align(L) get_table_align(L)
lua_State *L; lua_State *L;
{ {
const char *const aligns[] = { "noalign", "law", "neutral", "chaos", "coaligned", "noncoaligned", "random", NULL }; const char *const gtaligns[] = { "noalign", "law", "neutral", "chaos", "coaligned", "noncoaligned", "random", NULL };
const int aligns2i[] = { AM_NONE, AM_LAWFUL, AM_NEUTRAL, AM_CHAOTIC, AM_SPLEV_CO, AM_SPLEV_NONCO, AM_SPLEV_RANDOM, 0 }; const int aligns2i[] = { AM_NONE, AM_LAWFUL, AM_NEUTRAL, AM_CHAOTIC, AM_SPLEV_CO, AM_SPLEV_NONCO, AM_SPLEV_RANDOM, 0 };
int a = aligns2i[get_table_option(L, "align", "random", aligns)]; int a = aligns2i[get_table_option(L, "align", "random", gtaligns)];
return a; return a;
} }
@@ -2347,6 +2352,7 @@ const char *s;
for (i = LOW_PM; i < NUMMONS; i++) for (i = LOW_PM; i < NUMMONS; i++)
if (!strcmpi(mons[i].mname, s)) if (!strcmpi(mons[i].mname, s))
return i; return i;
nhUse(L);
return NON_PM; return NON_PM;
} }
@@ -2501,7 +2507,7 @@ lua_State *L;
tmpmons.coord = SP_COORD_PACK(mx, my); tmpmons.coord = SP_COORD_PACK(mx, my);
if (tmpmons.id != NON_PM && tmpmons.class == -1) if (tmpmons.id != NON_PM && tmpmons.class == -1)
tmpmons.class = def_monsyms[mons[tmpmons.id].mlet].sym; tmpmons.class = def_monsyms[(int) mons[tmpmons.id].mlet].sym;
create_monster(&tmpmons, g.coder->croom); create_monster(&tmpmons, g.coder->croom);
@@ -2528,6 +2534,7 @@ const char *name;
int rndval; int rndval;
{ {
int ret; int ret;
char buf[BUFSZ];
lua_getfield(L, 1, name); lua_getfield(L, 1, name);
if (lua_type(L, -1) == LUA_TNIL) { if (lua_type(L, -1) == LUA_TNIL) {
@@ -2541,7 +2548,6 @@ int rndval;
lua_pop(L, 1); lua_pop(L, 1);
return rndval; return rndval;
} }
char buf[BUFSZ];
Sprintf(buf, "Expected integer or \"random\" for \"%s\", got %s", name, tmp); Sprintf(buf, "Expected integer or \"random\" for \"%s\", got %s", name, tmp);
nhl_error(L, buf); nhl_error(L, buf);
lua_pop(L, 1); lua_pop(L, 1);
@@ -2626,7 +2632,9 @@ int
lspo_object(L) lspo_object(L)
lua_State *L; lua_State *L;
{ {
#if 0
int nparams = 0; int nparams = 0;
#endif
long quancnt; long quancnt;
object tmpobj; object tmpobj;
int ox = -1, oy = -1; int ox = -1, oy = -1;
@@ -2727,8 +2735,9 @@ lua_State *L;
tmpobj.id = -1; tmpobj.id = -1;
if (tmpobj.id == STATUE || tmpobj.id == EGG || tmpobj.id == CORPSE || tmpobj.id == TIN) { if (tmpobj.id == STATUE || tmpobj.id == EGG || tmpobj.id == CORPSE || tmpobj.id == TIN) {
int flags = 0; int lflags = 0;
const char *montype = get_table_str_opt(L, "montype", NULL); const char *montype = get_table_str_opt(L, "montype", NULL);
if (montype) { if (montype) {
struct permonst *pm = NULL; struct permonst *pm = NULL;
if (strlen(montype) == 1 && def_char_to_monclass(*montype) != MAXMCLASSES) { if (strlen(montype) == 1 && def_char_to_monclass(*montype) != MAXMCLASSES) {
@@ -2747,10 +2756,10 @@ lua_State *L;
nhl_error(L, "Unknown montype"); nhl_error(L, "Unknown montype");
} }
if (tmpobj.id == STATUE) { if (tmpobj.id == STATUE) {
flags |= (get_table_boolean_opt(L, "historic", 0) ? STATUE_HISTORIC : 0x00); lflags |= (get_table_boolean_opt(L, "historic", 0) ? STATUE_HISTORIC : 0x00);
flags |= (get_table_boolean_opt(L, "male", 0) ? STATUE_MALE : 0x00); lflags |= (get_table_boolean_opt(L, "male", 0) ? STATUE_MALE : 0x00);
flags |= (get_table_boolean_opt(L, "female", 0) ? STATUE_FEMALE : 0x00); lflags |= (get_table_boolean_opt(L, "female", 0) ? STATUE_FEMALE : 0x00);
tmpobj.spe = flags; tmpobj.spe = lflags;
} else if (tmpobj.id == EGG) { } else if (tmpobj.id == EGG) {
tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0; tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0;
} }
@@ -2877,7 +2886,7 @@ int
lspo_engraving(L) lspo_engraving(L)
lua_State *L; lua_State *L;
{ {
int etyp; int etyp = DUST;
char *txt = (char *) 0; char *txt = (char *) 0;
long ecoord; long ecoord;
const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL }; const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL };
@@ -2885,6 +2894,8 @@ lua_State *L;
xchar x, y; xchar x, y;
int argc = lua_gettop(L); int argc = lua_gettop(L);
x = y = 0; /* FIXME: quiet a warning for else clause below.
should it actually be -1? */
create_des_coder(); create_des_coder();
if (argc == 1) { if (argc == 1) {
@@ -2903,6 +2914,8 @@ lua_State *L;
txt = dupstr(luaL_checkstring(L, 3)); txt = dupstr(luaL_checkstring(L, 3));
} else { } else {
nhl_error(L, "Wrong parameters"); 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) if (x == -1 && y == -1)
@@ -2975,7 +2988,7 @@ lua_State *L;
const char *name; const char *name;
int defval; int defval;
{ {
char *roomstr = get_table_str_opt(L, name, ""); char *roomstr = get_table_str_opt(L, name, emptystr);
if (roomstr && *roomstr) { if (roomstr && *roomstr) {
int i; int i;
for (i = 0; room_types[i].name; i++) for (i = 0; room_types[i].name; i++)
@@ -3055,7 +3068,7 @@ lua_State *L;
static void static void
spo_endroom(coder) spo_endroom(coder)
struct sp_coder *coder; struct sp_coder *coder UNUSED;
{ {
if (g.coder->n_subroom > 1) { if (g.coder->n_subroom > 1) {
g.coder->n_subroom--; g.coder->n_subroom--;
@@ -3095,15 +3108,15 @@ lua_State *L;
const int stairdirs2i[] = { 0, 1 }; const int stairdirs2i[] = { 0, 1 };
long scoord; long scoord;
int ax = -1,ay = -1; int ax = -1, ay = -1;
int up; int up;
int ltype = lua_type(L, 1); int ltype = lua_type(L, 1);
create_des_coder(); create_des_coder();
if (argc == 1 && ltype == LUA_TSTRING) if (argc == 1 && ltype == LUA_TSTRING) {
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
else if (argc == 3 && ltype == LUA_TSTRING) { } else if (argc == 3 && ltype == LUA_TSTRING) {
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
ax = luaL_checkinteger(L, 2); ax = luaL_checkinteger(L, 2);
ay = luaL_checkinteger(L, 3); ay = luaL_checkinteger(L, 3);
@@ -3154,15 +3167,15 @@ lua_State *L;
const int stairdirs2i[] = { 0, 1 }; const int stairdirs2i[] = { 0, 1 };
long scoord; long scoord;
int ax, ay; int ax = -1, ay = -1; /* FIXME: initializers added, macosx warning */
int up; int up;
int ltype = lua_type(L, 1); int ltype = lua_type(L, 1);
create_des_coder(); create_des_coder();
if (argc == 1 && ltype == LUA_TSTRING) if (argc == 1 && ltype == LUA_TSTRING) {
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
else if (argc == 3 && ltype == LUA_TSTRING) { } else if (argc == 3 && ltype == LUA_TSTRING) {
up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)];
ax = luaL_checkinteger(L, 2); ax = luaL_checkinteger(L, 2);
ay = luaL_checkinteger(L, 3); ay = luaL_checkinteger(L, 3);
@@ -3325,7 +3338,7 @@ lua_State *L;
const char *name; const char *name;
int defval; int defval;
{ {
char *trapstr = get_table_str_opt(L, name, ""); char *trapstr = get_table_str_opt(L, name, emptystr);
if (trapstr && *trapstr) { if (trapstr && *trapstr) {
int i; int i;
for (i = 0; trap_types[i].name; i++) for (i = 0; trap_types[i].name; i++)
@@ -3474,7 +3487,7 @@ lua_State *L;
/* random_corridors(); */ /* random_corridors(); */
int int
lspo_random_corridors(L) lspo_random_corridors(L)
lua_State *L; lua_State *L UNUSED;
{ {
corridor tc; corridor tc;
@@ -5119,6 +5132,7 @@ lua_State *L;
return 0; return 0;
} }
#if 0
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
sel_set_wallify(x, y, arg) sel_set_wallify(x, y, arg)
@@ -5127,6 +5141,7 @@ genericptr_t arg UNUSED;
{ {
wallify_map(x, y, x, y); wallify_map(x, y, x, y);
} }
#endif
/* TODO: wallify(selection) */ /* TODO: wallify(selection) */
/* wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */ /* wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */
@@ -5161,7 +5176,7 @@ lua_State *L;
/* reset_level is only needed for testing purposes */ /* reset_level is only needed for testing purposes */
int int
lspo_reset_level(L) lspo_reset_level(L)
lua_State *L; lua_State *L UNUSED; /* macosx complaint needed UNUSED */
{ {
boolean wtower = In_W_tower(u.ux, u.uy, &u.uz); boolean wtower = In_W_tower(u.ux, u.uy, &u.uz);