From fd0a4ec878d7c51d73d01dbcddbc13fc1395e80d Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 3 Jun 2026 17:44:49 -0400 Subject: [PATCH] optlist.h maintenance A very small number of boolean options had drifted, such that their initval setting did not match its opt_in or opt_out value. Correct that, by ensuring opt_in or opt_out reflects what was actually happening. The only option whose initial value is changing as a result of this is timed_delay. It was listed as an opt_out option, but was not being initialized as such. Now it is. This makes the Mac X11 throwing animations work correctly with the earlier timed_delay option adjustments for X11. There was nothing displaying on Mac X11 after those earlier changes, unless the timed_delay option was turned on. Going forward, for boolean options, setting opt_in or opt_out is all that is required, as that was the original intention of those fields. It will take precedence if they fall out of sync again. --- include/optlist.h | 16 ++++++++-------- include/windconf.h | 2 ++ src/options.c | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/optlist.h b/include/optlist.h index c723e4981..fdc92d1d7 100644 --- a/include/optlist.h +++ b/include/optlist.h @@ -137,7 +137,7 @@ static int optfn_##a(int, int, boolean, char *, char *); "your starting alignment (lawful, neutral, or chaotic)") /* end of special ordering; remainder of entries are in alphabetical order */ - NHOPTB(accessiblemsg, Advanced, 0, opt_out, set_in_game, + NHOPTB(accessiblemsg, Advanced, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias, &a11y.accessiblemsg, Term_False, "add location information to messages") NHOPTB(acoustics, Advanced, 0, opt_out, set_in_game, @@ -171,7 +171,7 @@ static int optfn_##a(int, int, boolean, char *, char *); NHOPTB(armorstatus, Advanced, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias, &flags.armorstatus, Term_False, "summarize currently worn armor in a status field") - NHOPTB(ascii_map, Advanced, 0, opt_in, set_in_game, + NHOPTB(ascii_map, Advanced, 0, opt_out, set_in_game, ascii_map_Def, Yes, No, No, NoAlias, &iflags.wc_ascii_map, Term_False, "show map as text") NHOPTO("autocompletions", Advanced, o_autocomplete, BUFSZ, opt_in, @@ -185,7 +185,7 @@ static int optfn_##a(int, int, boolean, char *, char *); NHOPTB(autoopen, Behavior, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias, &flags.autoopen, Term_False, "walking into a door attempts to open it") - NHOPTB(autopickup, Behavior, 0, opt_out, set_in_game, + NHOPTB(autopickup, Behavior, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias, &flags.pickup, Term_False, "automatically pick up objects") NHOPTO("autopickup exceptions", Behavior, o_autopickup_exceptions, BUFSZ, @@ -237,7 +237,7 @@ static int optfn_##a(int, int, boolean, char *, char *); NHOPTB(cmdassist, Behavior, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias, &iflags.cmdassist, Term_False, "give help for errors on direction input") - NHOPTB(color, Map, 0, opt_in, set_in_game, + NHOPTB(color, Map, 0, opt_out, set_in_game, On, Yes, No, No, "colour", &iflags.wc_color, Term_False, "use color in map") NHOPTB(confirm, Advanced, 0, opt_out, set_in_game, @@ -456,7 +456,7 @@ static int optfn_##a(int, int, boolean, char *, char *); Yes, Yes, No, Yes, "use_menu_glyphs", "show object symbols in menus") #ifdef TTY_GRAPHICS - NHOPTB(menu_overlay, Advanced, 0, opt_in, set_in_game, + NHOPTB(menu_overlay, Advanced, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias, &iflags.menu_overlay, Term_False, "menus overlay and align to right") #else @@ -768,7 +768,7 @@ static int optfn_##a(int, int, boolean, char *, char *); "display game turns in status line") #ifdef TIMED_DELAY NHOPTB(timed_delay, Map, 0, opt_out, set_in_game, - Off, Yes, No, No, NoAlias, &flags.nap, Term_False, + On, Yes, No, No, NoAlias, &flags.nap, Term_False, "use delay when pausing for display effects") #else NHOPTB(timed_delay, Map, 0, opt_in, set_in_config, @@ -791,11 +791,11 @@ static int optfn_##a(int, int, boolean, char *, char *); On, Yes, No, No, NoAlias, &flags.travelcmd, Term_False, "enable traveling via mouse click") #ifdef DEBUG - NHOPTB(travel_debug, Advanced, 0, opt_out, set_wizonly, + NHOPTB(travel_debug, Advanced, 0, opt_in, set_wizonly, Off, Yes, No, No, NoAlias, &iflags.trav_debug, Term_False, (char *)0) #else - NHOPTB(travel_debug, Advanced, 0, opt_out, set_wizonly, + NHOPTB(travel_debug, Advanced, 0, opt_in, set_wizonly, Off, No, No, No, NoAlias, (boolean *) 0, Term_False, (char *)0) #endif diff --git a/include/windconf.h b/include/windconf.h index 0f493ca76..cf113aee1 100644 --- a/include/windconf.h +++ b/include/windconf.h @@ -39,6 +39,8 @@ #define IDLECHECKPOINT #endif +#define TIMED_DELAY + /* * ----------------------------------------------------------------- * The remaining code shouldn't need modification. diff --git a/src/options.c b/src/options.c index 1cbb64ac5..4f0cd9eea 100644 --- a/src/options.c +++ b/src/options.c @@ -7414,8 +7414,22 @@ allopt_array_init(void) memcpy(allopt, allopt_init, sizeof(allopt)); determine_ambiguities(); for (i = 0; allopt[i].name; i++) { - if (allopt[i].addr) + if (allopt[i].addr) { +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED \ + && NH_DEVEL_STATUS != NH_STATUS_POSTRELEASE) + if (allopt[i].opttyp == BoolOpt + && allopt[i].initval != allopt[i].opt_in_out) + if (wizard) + impossible("conflicting option init for %s: %s is %s, %s is %s", + allopt[i].name, + "opt_in_out", + allopt[i].opt_in_out ? "on" : "off", "initval", + allopt[i].initval ? "on" : "off"); +#endif + if (allopt[i].opttyp == BoolOpt) + allopt[i].initval = allopt[i].opt_in_out; *(allopt[i].addr) = allopt[i].initval; + } } heed_all_options(); /*