I added -Wmissing-prototypes to my CFLAGS and got a bunch of warnings.
This fixes the core ones (there are more for X11 that I haven't looked
at yet). While fixing these, I discovered a few option processing
issues: the non-Amiga 'altmeta' should be settable while the game is
in progress (not sure about the Amiga variation so left that as-is),
'altmeta' and 'menucolor' are booleans so shouldn't have had optfn_XXX
functions; 'MACgraphics' and 'subkeyvalue' were conditionally defined
differently in options.c than in optlist.h.
#endif
E void FDECL(sethanguphandler, (void (*)(int)));
E boolean NDECL(authorize_wizard_mode);
+E void FDECL(append_slash, (char *));
E boolean FDECL(check_user_string, (char *));
E char *NDECL(get_login_name);
+E unsigned long NDECL(sys_random_seed);
#endif /* UNIX */
/* ### unixtty.c ### */
al, z, #a, Off, h, 0 },
#endif
-/* B:nm, ln, opt_*, setwhere?, on?, negat?, val?, dup?, hndlr? Alias, boolptr */
+/* B:nm, ln, opt_*, setwhere?, on?, negat?, val?, dup?, hndlr? Alias, bool_p */
/* C:nm, ln, opt_*, setwhere?, negateok?, valok?, dupok?, hndlr? Alias, desc */
/* P:pfx, ln, opt_*, setwhere?, negateok?, valok?, dupok?, hndlr? Alias, desc*/
&sysflags.altmeta)
#else
#ifdef ALTMETA
- NHOPTB(altmeta, 0, opt_out, set_in_config, Off, No, No, No, NoAlias,
+ NHOPTB(altmeta, 0, opt_out, set_in_game, Off, No, No, No, NoAlias,
&iflags.altmeta)
#else
NHOPTB(altmeta, 0, opt_out, set_in_config, Off, No, No, No, NoAlias,
&flags.lit_corridor)
NHOPTB(lootabc, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&flags.lootabc)
-#ifdef BACKWARD_COMPAT
-#ifdef MAC_GRAPHICS_ENV
+#if defined(BACKWARD_COMPAT) && defined(MAC_GRAPHICS_ENV)
NHOPTC(Macgraphics, 70, opt_in, set_in_config, No, Yes, No, No, NoAlias,
"load MACGraphics display symbols")
-#endif
#endif
NHOPTB(mail, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&flags.biff)
#ifndef SPLITMON_1
+void NDECL(monst_globals_init); /* in hack.h but we're using config.h */
+
struct permonst mons[SIZE(mons_init)];
void
/* clang-format on */
/* *INDENT-ON* */
+void NDECL(objects_globals_init); /* in hack.h but we're using config.h */
+
struct objdescr obj_descr[SIZE(obj_descr_init)];
struct objclass objects[SIZE(obj_init)];
return optn_ok;
}
-int
-optfn_altmeta(optidx, req, negated, opts, op)
-int optidx UNUSED;
-int req;
-boolean negated UNUSED;
-char *opts;
-char *op UNUSED;
-{
- if (req == do_init) {
- return optn_ok;
- }
- if (req == do_set) {
- /* Amiga altmeta causes Alt+key to be converted into Meta+key by
- low level nethack code; on by default, can be toggled off if
- Alt+key is needed for some ASCII chars on non-ASCII keyboard */
-
- /* non-Amiga altmeta causes nethack's top level command loop to treat
- two character sequence "ESC c" as M-c, for terminals or emulators
- which send "ESC c" when Alt+c is pressed; off by default, enabling
- this can potentially make trouble if user types ESC when nethack
- is honoring this conversion request (primarily after starting a
- count prefix prior to a command and then deciding to cancel it) */
-
- return optn_ok;
- }
- if (req == get_val) {
- if (!opts)
- return optn_err;
- opts[0] = '\0';
- return optn_err;
- }
- return optn_ok;
-}
-
int
optfn_boulder(optidx, req, negated, opts, op)
int optidx UNUSED;
return optn_ok;
}
+#if defined(BACKWARD_COMPAT) && defined(MAC_GRAPHICS_ENV)
int
optfn_MACgraphics(optidx, req, negated, opts, op)
-#if defined(MAC_GRAPHICS_ENV) && defined(BACKWARD_COMPAT)
int optidx;
int req;
boolean negated;
char *opts;
char *op;
-#else
-int optidx UNUSED;
-int req;
-boolean negated UNUSED;
-char *opts UNUSED;
-char *op UNUSED;
-#endif
{
-#if defined(MAC_GRAPHICS_ENV) && defined(BACKWARD_COMPAT)
boolean badflag = FALSE;
if (req == do_init) {
opts[0] = '\0';
return optn_ok;
}
-#else
- if (req == do_set) {
- config_error_add("'%s' %s; use 'symset:%s' instead",
- allopt[optidx].name,
-#ifdef MAC_GRAPHICS_ENV /* implies BACKWARD_COMPAT is not defined */
- "no longer supported",
-#else
- "is not supported",
-#endif
- allopt[optidx].name);
- }
-#endif
return optn_ok;
}
+#endif /* BACKWARD_COMPAT && MAC_GRAPHICS_ENV */
int
optfn_map_mode(optidx, req, negated, opts, op)
return optn_ok;
}
-int
-optfn_menucolor(optidx, req, negated, opts, op)
-int optidx;
-int req;
-boolean negated UNUSED;
-char *opts;
-char *op;
-{
- if (req == do_init) {
- return optn_ok;
- }
- if (req == do_set) {
- /* menucolor:"regex_string"=color */
- if ((op = string_for_env_opt(allopt[optidx].name, opts, FALSE))
- != empty_optstr) {
- if (!add_menu_coloring(op))
- return optn_err;
- } else
- return optn_err;
- return optn_ok;
- }
- if (req == get_val) {
- if (!opts)
- return optn_err;
- opts[0] = '\0';
- return optn_ok;
- }
- return optn_ok;
-}
-
int
optfn_menuinvertmode(optidx, req, negated, opts, op)
int optidx;
return optn_ok;
}
+#ifdef WIN32
int
optfn_subkeyvalue(optidx, req, negated, opts, op)
int optidx UNUSED;
return optn_ok;
}
if (req == do_set) {
-#if defined(WIN32)
if (op == empty_optstr)
return optn_err;
#ifdef TTY_GRAPHICS
map_subkeyvalue(op);
-#endif
#endif
return optn_ok;
}
}
return optn_ok;
}
+#endif /* WIN32 */
int
optfn_suppress_alert(optidx, req, negated, opts, op)
extern void FDECL(mkmap, (lev_init *));
+static boolean FDECL(match_maptyps, (XCHAR_P, XCHAR_P));
static void NDECL(solidify_map);
static void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P));
static void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P));
static void NDECL(spo_pop_container);
static int FDECL(l_create_stairway, (lua_State *, BOOLEAN_P));
static void FDECL(spo_endroom, (struct sp_coder *));
-static void FDECL(l_table_getset_feature_flag, (lua_State *, int, int, const char *, int));
+static void FDECL(l_table_getset_feature_flag, (lua_State *, int, int,
+ const char *, int));
static void FDECL(sel_set_lit, (int, int, genericptr_t));
-static void FDECL(selection_iterate, (struct selectionvar *, select_iter_func, genericptr_t));
+static void FDECL(selection_iterate, (struct selectionvar *, select_iter_func,
+ genericptr_t));
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 void FDECL(set_wallprop_in_selection, (lua_State *, int));
static int FDECL(floodfillchk_match_under, (int, int));
static int FDECL(floodfillchk_match_accessible, (int, int));
+static boolean FDECL(sel_flood_havepoint, (int, int, xchar *, xchar *, int));
+static long FDECL(line_dist_coord, (long, long, long, long, long, long));
static void FDECL(l_push_wid_hei_table, (lua_State *, int, int));
static int FDECL(get_table_align, (lua_State *));
static int FDECL(get_table_monclass, (lua_State *));
/* Does typ match with levl[][].typ, considering special types
MATCH_WALL and MAX_TYPE (aka transparency)? */
-boolean
+static boolean
match_maptyps(typ, levltyp)
xchar typ, levltyp;
{
}
/* distance from line segment (x1,y1, x2,y2) to point (x3,y3) */
-long
+static long
line_dist_coord(x1, y1, x2, y2, x3, y3)
long x1, y1, x2, y2, x3, y3;
{