Make initoptions() call initoptions_init() if that hasn't already happened.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1708124177 2024/02/16 22:56:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.707 $ */
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1708737173 2024/02/24 01:12:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.709 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2008. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -96,7 +96,7 @@ enum requests {
|
||||
};
|
||||
/* these aren't the same as set_xxx in optlist.h */
|
||||
enum option_phases {
|
||||
builtin_opt, /* compiled-in default value of an option */
|
||||
builtin_opt=1,/* compiled-in default value of an option */
|
||||
syscf_opt, /* sysconf setting of an option, overrides builtin */
|
||||
rc_file_opt, /* player's run-time config file setting, overrides syscf */
|
||||
environ_opt, /* player's environment NETHACKOPTIONS, overrides rc_file */
|
||||
@@ -6707,6 +6707,15 @@ initoptions(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Most places that call initoptions_init()/initoptions() would
|
||||
* have the calls next to each other, so instead of adding
|
||||
* initoptions_init() everywhere, just add it where it's needed in
|
||||
* a non-adjacent place and call it here for all the other cases.
|
||||
*/
|
||||
if(go.opt_phase != builtin_opt)
|
||||
initoptions_init();
|
||||
|
||||
/*
|
||||
* Call each option function with an init flag and give it a chance
|
||||
* to make any preparations that it might require. We do this
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 unixmain.c $NHDT-Date: 1704043695 2023/12/31 17:28:15 $ $NHDT-Branch: keni-luabits2 $:$NHDT-Revision: 1.124 $ */
|
||||
/* NetHack 3.7 unixmain.c $NHDT-Date: 1708737183 2024/02/24 01:13:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.126 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -150,7 +150,6 @@ main(int argc, char *argv[])
|
||||
check_linux_console();
|
||||
#endif
|
||||
|
||||
initoptions_init();
|
||||
initoptions();
|
||||
#ifdef PANICTRACE
|
||||
ARGV0 = gh.hname; /* save for possible stack trace */
|
||||
@@ -786,7 +785,6 @@ opt_showpaths(const char *dir)
|
||||
nhUse(dir);
|
||||
#endif
|
||||
iflags.initoptions_noterminate = TRUE;
|
||||
initoptions_init();
|
||||
initoptions();
|
||||
iflags.initoptions_noterminate = FALSE;
|
||||
reveal_paths();
|
||||
|
||||
Reference in New Issue
Block a user