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

Function Gem_get_ext_cmd

outdated/win/gem/wingem.c:979–1013  ·  view source on GitHub ↗

Get a extended command in windowport specific way. returns index of the ext_cmd or -1. called after '#'. It's a menu with all the possibilities. */

Source from the content-addressed store, hash-verified

977 called after '#'.
978 It's a menu with all the possibilities. */
979int
980Gem_get_ext_cmd()
981{
982 winid wind;
983 int i, count, what, too_much = FALSE;
984 menu_item *selected = NULL;
985 anything any;
986 char accelerator = 0, tmp_acc = 0;
987 const char *ptr;
988
989 wind = Gem_create_nhwindow(NHW_MENU);
990 Gem_start_menu(wind, MENU_BEHAVE_STANDARD);
991 for (i = 0; (ptr = extcmdlist[i].ef_txt); i++) {
992 any.a_int = i;
993 accelerator = *ptr;
994 if (tmp_acc == accelerator) {
995 if (too_much)
996 accelerator = '&'; /* MAR -- poor choice, anyone? */
997 else
998 accelerator += 'A' - 'a';
999 too_much = TRUE;
1000 } else
1001 too_much = FALSE;
1002 tmp_acc = *ptr;
1003 Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr,
1004 MENU_ITEMFLAGS_NONE);
1005 }
1006 Gem_end_menu(wind, "What extended command?");
1007 count = Gem_select_menu(wind, PICK_ONE, &selected);
1008 what = count ? selected->item.a_int : -1;
1009 if (selected)
1010 free(selected);
1011 Gem_destroy_nhwindow(wind);
1012 return (what);
1013}
1014
1015void
1016Gem_number_pad(state)

Callers

nothing calls this directly

Calls 6

Gem_create_nhwindowFunction · 0.85
Gem_start_menuFunction · 0.85
Gem_add_menuFunction · 0.85
Gem_end_menuFunction · 0.85
Gem_select_menuFunction · 0.85
Gem_destroy_nhwindowFunction · 0.85

Tested by

no test coverage detected