/* * Display a list of commands. */ static bool cmd_menu(ref Command_List list, object selection_p) { Menu_Type menu; Menu_Type.menu_iter commands_menu = new Menu_Type.menu_iter(null, null, cmd_sub_entry, null, null); Region area = new Region(23, 4, 37, 13); ui_event evt; //Command_Info selection = selection_p as Command_Info; /* Set up the menu */ menu = new Menu_Type(Menu_Type.skin_id.SCROLL, commands_menu); menu.priv(list.list.Length, list.list); menu.layout(area); /* Set up the screen */ Utilities.screen_save(); Utilities.window_make(21, 3, 62, 17); /* Select an entry */ evt = menu.select(0, true); /* Load de screen */ Utilities.screen_load(); if (evt.type == ui_event_type.EVT_SELECT) { selection_p = list.list[menu.cursor]; //This was originally selection as above } return(false); }
/* Set up one of our menus ready to display choices for a birth question. * This is slightly involved. */ static void init_birth_menu(ref Menu_Type menu, int n_choices, int initial_choice, Region reg, bool allow_random, Menu_Type.browse_hook_func aux) { birthmenu_data menu_data; /* Initialise a basic menu */ menu = new Menu_Type(Menu_Type.skin_id.SCROLL, birth_iter); /* A couple of behavioural flags - we want selections letters in * lower case and a double tap to act as a selection. */ menu.selections = TextUI.lower_case; menu.flags = (int)Menu_Type.menu_type_flags.MN_DBL_TAP; /* Copy across the game's suggested initial selection, etc. */ menu.cursor = initial_choice; /* Allocate sufficient space for our own bits of menu information. */ menu_data = new birthmenu_data(); /* Allocate space for an array of menu item texts and help texts * (where applicable) */ menu_data.items = new string[n_choices]; menu_data.allow_random = allow_random; /* Set private data */ menu.priv(n_choices, menu_data); /* Set up the "browse" hook to display help text (where applicable). */ menu.browse_hook = aux; /* Lay out the menu appropriately */ menu.layout(reg); }
public static void knowledge_init() { /* Initialize the menus */ knowledge_menu = new Menu_Type(Menu_Type.skin_id.SCROLL, Menu_Type.menu_find_iter(Menu_Type.menu_iter_id.ACTIONS)); knowledge_menu.priv(knowledge_actions.Length, knowledge_actions); knowledge_menu.title = "Display current knowledge"; knowledge_menu.selections = lower_case; /* initialize other static variables */ if (obj_group_order == null) { int i; int gid = -1; obj_group_order = new int[Object.TVal.TV_GOLD + 1]; Utilities.atexit(cleanup_cmds); /* Allow for missing values */ for (i = 0; i <= Object.TVal.TV_GOLD; i++) { obj_group_order[i] = -1; } for (i = 0; 0 != object_text_order[i].tval; i++) { if (object_text_order[i].name != null) { gid = i; } obj_group_order[object_text_order[i].tval] = gid; } } }
public static void store_menu_recalc(Menu_Type m) { Store store = current_store(); m.priv(store.stock_num, store.stock); }
/* * Display a list of commands. */ static bool cmd_menu(ref Command_List list, object selection_p) { Menu_Type menu; Menu_Type.menu_iter commands_menu = new Menu_Type.menu_iter( null, null, cmd_sub_entry, null, null ); Region area = new Region(23, 4, 37, 13); ui_event evt; //Command_Info selection = selection_p as Command_Info; /* Set up the menu */ menu = new Menu_Type(Menu_Type.skin_id.SCROLL, commands_menu); menu.priv(list.list.Length, list.list); menu.layout(area); /* Set up the screen */ Utilities.screen_save(); Utilities.window_make(21, 3, 62, 17); /* Select an entry */ evt = menu.select(0, true); /* Load de screen */ Utilities.screen_load(); if (evt.type == ui_event_type.EVT_SELECT) selection_p = list.list[menu.cursor]; //This was originally selection as above return false; }