From 450efa0dc4b5b67065013aa869da231c7a6735de Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 15 Sep 2023 12:35:42 -0700 Subject: [PATCH] status hilites fix The options menu for status hilites wouldn't work as intended if the entries in the initblstats[] array were changed to not be in BL_xyz order. (No effect on current behavior since they are in that order.) --- src/botl.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/botl.c b/src/botl.c index 95bf6d3ef..49addd43d 100644 --- a/src/botl.c +++ b/src/botl.c @@ -4121,7 +4121,7 @@ boolean status_hilite_menu(void) { winid tmpwin; - int i, res; + int i, fld, res; menu_item *picks = (menu_item *) 0; anything any; boolean redo; @@ -4149,19 +4149,21 @@ status_hilite_menu(void) } for (i = 0; i < MAXBLSTATS; i++) { - int count = status_hilite_linestr_countfield(i); + int count; char buf[BUFSZ]; + fld = initblstats[i].fld; + count = status_hilite_linestr_countfield(fld); #ifndef SCORE_ON_BOTL /* config file might contain rules for highlighting 'score' even when SCORE_ON_BOTL is disabled; if so, 'O' command 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) + if (fld == BL_SCORE && !count) continue; #endif any = cg.zeroany; - any.a_int = i + 1; + any.a_int = fld + 1; Sprintf(buf, "%-18s", initblstats[i].fldname); if (count) Sprintf(eos(buf), " (%d defined)", count); @@ -4171,11 +4173,11 @@ status_hilite_menu(void) end_menu(tmpwin, "Status hilites:"); if ((res = select_menu(tmpwin, PICK_ONE, &picks)) > 0) { - i = picks->item.a_int - 1; - if (i < 0) { + fld = picks->item.a_int - 1; + if (fld < 0) { status_hilites_viewall(); } else { - if (status_hilite_menu_fld(i)) + if (status_hilite_menu_fld(fld)) reset_status_hilites(); } free((genericptr_t) picks), picks = (menu_item *) 0;