diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 430c0799d..637367fca 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1710,6 +1710,10 @@ applying a wielded lump of royal jelly but not picking something to rub it on "addinv: null obj after quiver merge" (like applying lit potion of oil) ceiling hider could become hidden when there was no ceiling, triggering a warning if sanity_check was On +experimental #saveoptions wasn't saving the set of cond_xyz options correctly; + if player viewed the 'm O' submenu for status conditions, they would + get saved even if not changed; otherwise, ones that came in from the + old RC file wouldn't be included in the new one Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 07bd4058d..375631468 100644 --- a/include/extern.h +++ b/include/extern.h @@ -199,7 +199,7 @@ extern int stat_hunger_indx(void); extern const char *bl_idx_to_fldname(int); extern void condopt(int, boolean *, boolean); extern int parse_cond_option(boolean, char *); -extern void cond_menu(void); +extern boolean cond_menu(void); extern boolean opt_next_cond(int, char *); #ifdef STATUS_HILITES extern void status_eval_next_unhilite(void); diff --git a/src/botl.c b/src/botl.c index f2d29a674..c63ce6192 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1043,8 +1043,7 @@ condopt(int idx, boolean *addr, boolean negated) condtests[idx].enabled = negated ? FALSE : TRUE; condtests[idx].choice = condtests[idx].enabled; /* avoid lingering false positives if test is no longer run */ - if (!condtests[idx].enabled) - condtests[idx].test = FALSE; + condtests[idx].test = FALSE; } } @@ -1090,7 +1089,9 @@ parse_cond_option(boolean negated, char *opts) return 1; /* !0 indicates error */ } -void +/* display a menu of all available status condition options and let player + toggled them on or off; returns True iff any changes are made */ +boolean cond_menu(void) { static const char *const menutitle[2] = { @@ -1104,6 +1105,7 @@ cond_menu(void) char mbuf[QBUFSZ]; boolean showmenu = TRUE; int clr = 0; + boolean changed = FALSE; do { for (i = 0; i < CONDITION_COUNT; ++i) { @@ -1164,10 +1166,11 @@ cond_menu(void) for (i = 0; i < CONDITION_COUNT; ++i) if (condtests[i].enabled != condtests[i].choice) { condtests[i].enabled = condtests[i].choice; - gc.context.botl = TRUE; + condtests[idx].test = FALSE; + gc.context.botl = changed = TRUE; } } - return; + return changed; } /* called by all_options_conds() to get value for next cond_xyz option diff --git a/src/options.c b/src/options.c index 079a53328..e5b4de606 100644 --- a/src/options.c +++ b/src/options.c @@ -4699,7 +4699,7 @@ optfn_windowtype(int optidx, int req, boolean negated UNUSED, static int pfxfn_cond_( - int optidx, + int optidx UNUSED, int req, boolean negated, char *opts, @@ -4714,7 +4714,7 @@ pfxfn_cond_( switch (reslt) { case 0: - opt_set_in_config[optidx] = TRUE; + opt_set_in_config[pfx_cond_] = TRUE; break; case 3: config_error_add("Ambiguous condition option %s", opts); @@ -4737,8 +4737,8 @@ pfxfn_cond_( opts[0] = '\0'; return optn_ok; } - if (req == do_handler) { - cond_menu(); /* in botl.c */ + if (req == do_handler) { /* not used */ + (void) cond_menu(); /* in botl.c */ return optn_ok; } return optn_ok; @@ -8339,7 +8339,8 @@ optfn_o_status_cond( ; /* handled inline by all_options_strbuf() via all_options_conds() */ } if (req == do_handler) { - cond_menu(); + if (cond_menu()) + opt_set_in_config[pfx_cond_] = TRUE; return optn_ok; } return optn_ok; @@ -8574,7 +8575,7 @@ doset_simple_menu(void) reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler, FALSE, empty_optstr, empty_optstr); /* if player eventually saves options, include this one */ - if (reslt == optn_ok) + if (reslt == optn_ok && allopt[k].idx != pfx_cond_) opt_set_in_config[k] = TRUE; } else { Sprintf(buf, "Set %s to what?", allopt[k].name); @@ -9564,8 +9565,10 @@ all_options_strbuf(strbuf_t *sbuf) } /* cond_xyz are closer to regular options than the other 'other opts' - so put them next */ - if (opt_set_in_config[opt_o_status_cond]) + so put them next; [pfx_cond_] will be set if any cond_Foo were + present when RC file was read in or if player made any changes via + status conditions menu; ignore opt_set_in_config[opt_o_status_cond] */ + if (opt_set_in_config[pfx_cond_]) all_options_conds(sbuf); get_changed_key_binds(sbuf);