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

Function status_hilite_menu_choose_behavior

src/botl.c:3706–3808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3704}
3705
3706staticfn int
3707status_hilite_menu_choose_behavior(int fld)
3708{
3709 winid tmpwin;
3710 int res = 0, beh = BL_TH_NONE-1;
3711 anything any;
3712 menu_item *picks = (menu_item *) 0;
3713 char buf[BUFSZ];
3714 int at;
3715 int onlybeh = BL_TH_NONE, nopts = 0;
3716 int clr = NO_COLOR;
3717
3718 if (fld < 0 || fld >= MAXBLSTATS)
3719 return BL_TH_NONE;
3720
3721 at = initblstats[fld].anytype;
3722
3723 tmpwin = create_nhwindow(NHW_MENU);
3724 start_menu(tmpwin, MENU_BEHAVE_STANDARD);
3725
3726 if (fld != BL_CONDITION) {
3727 any = cg.zeroany;
3728 any.a_int = onlybeh = BL_TH_ALWAYS_HILITE;
3729 Sprintf(buf, "Always highlight %s", initblstats[fld].fldname);
3730 add_menu(tmpwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE,
3731 clr, buf, MENU_ITEMFLAGS_NONE);
3732 nopts++;
3733 }
3734
3735 if (fld == BL_CONDITION) {
3736 any = cg.zeroany;
3737 any.a_int = onlybeh = BL_TH_CONDITION;
3738 add_menu(tmpwin, &nul_glyphinfo, &any, 'b', 0, ATR_NONE,
3739 clr, "Bitmask of conditions", MENU_ITEMFLAGS_NONE);
3740 nopts++;
3741 }
3742
3743 if (fld != BL_CONDITION && fld != BL_VERS) {
3744 any = cg.zeroany;
3745 any.a_int = onlybeh = BL_TH_UPDOWN;
3746 Sprintf(buf, "%s value changes", initblstats[fld].fldname);
3747 add_menu(tmpwin, &nul_glyphinfo, &any, 'c', 0, ATR_NONE,
3748 clr, buf, MENU_ITEMFLAGS_NONE);
3749 nopts++;
3750 }
3751
3752 if (fld != BL_CAP && fld != BL_HUNGER
3753 && (at == ANY_INT || at == ANY_LONG)) {
3754 any = cg.zeroany;
3755 any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE;
3756 add_menu(tmpwin, &nul_glyphinfo, &any, 'n', 0, ATR_NONE,
3757 clr, "Number threshold", MENU_ITEMFLAGS_NONE);
3758 nopts++;
3759 }
3760
3761 if (initblstats[fld].idxmax >= 0) {
3762 any = cg.zeroany;
3763 any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE;

Callers 1

status_hilite_menu_addFunction · 0.85

Calls 2

add_menuFunction · 0.85
select_menuFunction · 0.85

Tested by

no test coverage detected