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

Function setup_algnmenu

src/role.c:2978–3012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2976}
2977
2978staticfn void
2979setup_algnmenu(
2980 winid win,
2981 boolean filtering,
2982 int role, int race, int gend)
2983{
2984 anything any;
2985 boolean algn_ok;
2986 int i;
2987 char this_ch;
2988 int clr = NO_COLOR;
2989
2990 any = cg.zeroany;
2991 for (i = 0; i < ROLE_ALIGNS; i++) {
2992 /* no ok_gend(); alignment isn't constrained by gender */
2993 algn_ok = (ok_align(role, race, gend, i)
2994 && ok_role(role, race, gend, i)
2995 && ok_race(role, race, gend, i));
2996 if (filtering && !algn_ok)
2997 continue;
2998 if (filtering)
2999 any.a_int = i + 1;
3000 else
3001 any.a_string = aligns[i].adj;
3002 this_ch = *aligns[i].adj;
3003 /* (see setup_racemenu for explanation of selector letters
3004 and setup_rolemenu for preselection) */
3005 add_menu(win, &nul_glyphinfo, &any,
3006 filtering ? this_ch : highc(this_ch),
3007 filtering ? highc(this_ch) : 0,
3008 ATR_NONE, clr, aligns[i].adj,
3009 (!filtering && !algn_ok)
3010 ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
3011 }
3012}
3013
3014#else /* !TTY_GRAPHICS */
3015

Callers 2

genl_player_setupFunction · 0.85
reset_role_filteringFunction · 0.85

Calls 5

ok_alignFunction · 0.85
ok_roleFunction · 0.85
ok_raceFunction · 0.85
add_menuFunction · 0.85
highcFunction · 0.85

Tested by

no test coverage detected