MCPcopy Index your code
hub / github.com/NetHack/NetHack / initoptions_init

Function initoptions_init

src/options.c:7118–7305  ·  view source on GitHub ↗

set up default values for options where 0 or False isn't sufficient */

Source from the content-addressed store, hash-verified

7116
7117/* set up default values for options where 0 or False isn't sufficient */
7118void
7119initoptions_init(void)
7120{
7121#if (defined(UNIX) || defined(VMS)) && defined(TTY_GRAPHICS)
7122 char *opts;
7123#endif
7124 int i;
7125 boolean have_branch = (nomakedefs.git_branch && *nomakedefs.git_branch);
7126
7127 go.opt_phase = builtin_opt; /* Did I need to move this here? */
7128 /* initialize the function pointers for saving the game */
7129 sf_init();
7130 allopt_array_init();
7131 /* if windowtype has been specified on the command line, set it up
7132 early so windowtype-specific options use it as their base */
7133 if (gc.cmdline_windowsys) {
7134 nmcpy(gc.chosen_windowtype, gc.cmdline_windowsys, WINTYPELEN);
7135 config_error_init(FALSE, "command line", FALSE);
7136 choose_windows(gc.cmdline_windowsys);
7137 config_error_done();
7138 /*
7139 * FIXME? This continues even if setting windowtype to player's
7140 * specified value fails. It doesn't lock the windowtype in
7141 * that situation though, so the game will use whatever is in
7142 * RC/NETHACKOPTIONS or resort to DEFAULT_WINDOW_SYS.
7143 */
7144 if (windowprocs.name
7145 && !strcmpi(windowprocs.name, gc.cmdline_windowsys))
7146 /* ignore any windowtype:foo in RC file or NETHACKOPTIONS */
7147 iflags.windowtype_locked = TRUE;
7148 /* shouldn't need cmdline_windowsys beyond here */
7149 free((genericptr_t) gc.cmdline_windowsys),
7150 gc.cmdline_windowsys = NULL;
7151 }
7152
7153 /* make any symbol parsing quicker */
7154 if (!glyphid_cache_status())
7155 fill_glyphid_cache();
7156
7157 /* set up the command parsing */
7158 reset_commands(TRUE); /* init */
7159
7160 /* initialize the random number generator(s) */
7161 init_random(rn2);
7162 init_random(rn2_on_display_rng);
7163
7164 go.opt_phase = builtin_opt;
7165 for (i = 0; allopt[i].name; i++) {
7166 if (allopt[i].addr)
7167 *(allopt[i].addr) = allopt[i].initval;
7168 }
7169
7170 flags.end_own = FALSE;
7171 flags.end_top = 3;
7172 flags.end_around = 2;
7173 flags.paranoia_bits = PARANOID_PRAY | PARANOID_SWIM | PARANOID_TRAP;
7174 flags.versinfo = have_branch ? 4 : 1;
7175 flags.pile_limit = PILE_LIMIT_DFLT; /* 5 */

Callers 2

MAINFunction · 0.85
initoptionsFunction · 0.85

Calls 15

sf_initFunction · 0.85
allopt_array_initFunction · 0.85
nmcpyFunction · 0.85
config_error_initFunction · 0.85
choose_windowsFunction · 0.85
config_error_doneFunction · 0.85
glyphid_cache_statusFunction · 0.85
fill_glyphid_cacheFunction · 0.85
reset_commandsFunction · 0.85
init_randomFunction · 0.85
init_ov_primary_symbolsFunction · 0.85
init_ov_rogue_symbolsFunction · 0.85

Tested by

no test coverage detected