hilite_status: score vs !SCORE_ON_BOTL reprise

Handle suppression of 'score' from the 'O' menu for viewing and
setting hilite_status rules differently so that the count of the
number of rules will always match the number of rules shown by the
'a - View all hilites in config format' choice.  If there are score
rules in the config file for a game running under !SCORE_ON_BOTL
configuration, list 'score' normally but if player picks that menu
entry, the followup menu will have the existing rule(s) and 'X -
remove selected hilites' but not 'Z - Add a new hilite'.  If there
aren't any score rules--or there were some but they've now all been
'X'd--then 'score' won't be listed as one of the status fields.
This commit is contained in:
PatR
2018-06-26 17:36:00 -07:00
parent c04b652e40
commit 7af51743b7

View File

@@ -2431,12 +2431,6 @@ int fld;
int count = 0;
for (tmp = status_hilite_str; tmp; tmp = tmp->next) {
#ifndef SCORE_ON_BOTL
/* when SCORE_ON_BOTL is disabled, only count 'score' rules
if explicitly asked to do so; exclude them from 'all' count */
if (countall && tmp->fld == BL_SCORE)
continue;
#endif
if (countall || tmp->fld == fld)
count++;
}
@@ -2647,7 +2641,8 @@ status_hilite_menu_choose_field()
for (i = 0; i < MAXBLSTATS; i++) {
#ifndef SCORE_ON_BOTL
if (initblstats[i].fld == BL_SCORE)
if (initblstats[i].fld == BL_SCORE
&& !blstats[0][BL_SCORE].thresholds)
continue;
#endif
any = zeroany;
@@ -3334,10 +3329,21 @@ int fld;
"Remove selected hilites", MENU_UNSELECTED);
}
any = zeroany;
any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE,
"Add a new hilite", MENU_UNSELECTED);
#ifndef SCORE_ON_BOTL
if (fld == BL_SCORE) {
/* suppress 'Z - Add a new hilite' for 'score' when SCORE_ON_BOTL
is disabled; we wouldn't be called for 'score' unless it has
hilite rules from the config file, so count must be positive
(hence there's no risk that we're putting up an empty menu) */
;
} else
#endif
{
any = zeroany;
any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE,
"Add a new hilite", MENU_UNSELECTED);
}
Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname);
end_menu(tmpwin, buf);
@@ -3445,9 +3451,9 @@ shlmenu_redo:
#ifndef SCORE_ON_BOTL
/* config file might contain rules for highlighting 'score'
even when SCORE_ON_BOTL is disabled; if so, 'O' command
menus won't manipulate them, but will display them for
the "View all hilites in config format" operation */
if (initblstats[i].fld == BL_SCORE)
menus will show them and allow deletions but not additions,
otherwise, it won't show 'score' at all */
if (initblstats[i].fld == BL_SCORE && !count)
continue;
#endif
any = zeroany;