MCPcopy Create free account
hub / github.com/NetHack/NetHack / status_hilite_menu

Function status_hilite_menu

src/botl.c:4497–4578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4495}
4496
4497boolean
4498status_hilite_menu(void)
4499{
4500 winid tmpwin;
4501 int i, fld, res;
4502 menu_item *picks = (menu_item *) 0;
4503 anything any;
4504 boolean redo;
4505 int countall;
4506 int clr = NO_COLOR;
4507
4508 shlmenu_redo:
4509 redo = FALSE;
4510
4511 tmpwin = create_nhwindow(NHW_MENU);
4512 start_menu(tmpwin, MENU_BEHAVE_STANDARD);
4513
4514 status_hilite_linestr_gather();
4515 countall = status_hilite_linestr_countfield(BL_FLUSH);
4516 if (countall) {
4517 any = cg.zeroany;
4518 any.a_int = -1;
4519 add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
4520 clr, "View all hilites in config format",
4521 MENU_ITEMFLAGS_NONE);
4522
4523 add_menu_str(tmpwin, "");
4524 }
4525
4526 for (i = 0; i < MAXBLSTATS; i++) {
4527 int count;
4528 char buf[BUFSZ];
4529
4530 fld = initblstats[i].fld;
4531 count = status_hilite_linestr_countfield(fld);
4532#ifndef SCORE_ON_BOTL
4533 /* config file might contain rules for highlighting 'score'
4534 even when SCORE_ON_BOTL is disabled; if so, 'O' command
4535 menus will show them and allow deletions but not additions,
4536 otherwise, it won't show 'score' at all */
4537 if (fld == BL_SCORE && !count)
4538 continue;
4539#endif
4540 any = cg.zeroany;
4541 any.a_int = fld + 1;
4542 Sprintf(buf, "%-18s", initblstats[i].fldname);
4543 if (count)
4544 Sprintf(eos(buf), " (%d defined)", count);
4545 add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
4546 clr, buf, MENU_ITEMFLAGS_NONE);
4547 }
4548
4549 end_menu(tmpwin, "Status hilites:");
4550 if ((res = select_menu(tmpwin, PICK_ONE, &picks)) > 0) {
4551 fld = picks->item.a_int - 1;
4552 if (fld < 0) {
4553 status_hilites_viewall();
4554 } else {

Callers 1

optfn_o_status_hilitesFunction · 0.85

Calls 10

add_menuFunction · 0.85
add_menu_strFunction · 0.85
eosFunction · 0.85
select_menuFunction · 0.85
status_hilites_viewallFunction · 0.85
status_hilite_menu_fldFunction · 0.85
reset_status_hilitesFunction · 0.85

Tested by

no test coverage detected