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

Function status_hilite_menu_fld

src/botl.c:4356–4453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4354}
4355
4356staticfn boolean
4357status_hilite_menu_fld(int fld)
4358{
4359 winid tmpwin;
4360 int i, res;
4361 menu_item *picks = (menu_item *) 0;
4362 anything any;
4363 int count = status_hilite_linestr_countfield(fld);
4364 struct _status_hilite_line_str *hlstr;
4365 char buf[BUFSZ];
4366 boolean acted;
4367 int clr = NO_COLOR;
4368
4369 if (!count) {
4370 if (status_hilite_menu_add(fld)) {
4371 status_hilite_linestr_done();
4372 status_hilite_linestr_gather();
4373 count = status_hilite_linestr_countfield(fld);
4374 } else
4375 return FALSE;
4376 }
4377
4378 tmpwin = create_nhwindow(NHW_MENU);
4379 start_menu(tmpwin, MENU_BEHAVE_STANDARD);
4380
4381 if (count) {
4382 hlstr = status_hilite_str;
4383 while (hlstr) {
4384 if (hlstr->fld == fld) {
4385 any = cg.zeroany;
4386 any.a_int = hlstr->id;
4387 add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
4388 clr, hlstr->str, MENU_ITEMFLAGS_NONE);
4389 }
4390 hlstr = hlstr->next;
4391 }
4392 } else {
4393 Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname);
4394 add_menu_str(tmpwin, buf);
4395 }
4396
4397 /* separator line */
4398 add_menu_str(tmpwin, "");
4399
4400 if (count) {
4401 any = cg.zeroany;
4402 any.a_int = -1;
4403 add_menu(tmpwin, &nul_glyphinfo, &any, 'X', 0, ATR_NONE, clr,
4404 "Remove selected hilites", MENU_ITEMFLAGS_NONE);
4405 }
4406
4407#ifndef SCORE_ON_BOTL
4408 if (fld == BL_SCORE) {
4409 /* suppress 'Z - Add a new hilite' for 'score' when SCORE_ON_BOTL
4410 is disabled; we wouldn't be called for 'score' unless it has
4411 hilite rules from the config file, so count must be positive
4412 (hence there's no risk that we're putting up an empty menu) */
4413 ;

Callers 1

status_hilite_menuFunction · 0.85

Calls 8

status_hilite_menu_addFunction · 0.85
add_menuFunction · 0.85
add_menu_strFunction · 0.85
select_menuFunction · 0.85
status_hilite_removeFunction · 0.85

Tested by

no test coverage detected