MCPcopy Create free account
hub / github.com/crawl/crawl / choose_ability_menu

Function choose_ability_menu

crawl-ref/source/ability.cc:4151–4278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4149}
4150
4151int choose_ability_menu(const vector<talent>& talents)
4152{
4153 // TODO: refactor this into a proper subclass
4154 ToggleableMenu abil_menu(MF_SINGLESELECT | MF_ANYPRINTABLE
4155 | MF_NO_WRAP_ROWS | MF_TOGGLE_ACTION | MF_ARROWS_SELECT
4156 | MF_INIT_HOVER);
4157
4158 abil_menu.set_highlighter(nullptr);
4159#ifdef USE_TILE_LOCAL
4160 {
4161 // Hack like the one in spl-cast.cc:list_spells() to align the title.
4162 ToggleableMenuEntry* me =
4163 new ToggleableMenuEntry("Ability - do what? "
4164 "Cost Failure",
4165 "Ability - describe what? "
4166 "Cost Failure",
4167 MEL_ITEM);
4168 me->colour = BLUE;
4169 abil_menu.set_title(me, true, true);
4170 }
4171#else
4172 abil_menu.set_title(
4173 new ToggleableMenuEntry("Ability - do what? "
4174 "Cost Failure",
4175 "Ability - describe what? "
4176 "Cost Failure",
4177 MEL_TITLE), true, true);
4178#endif
4179 abil_menu.set_tag("ability");
4180 abil_menu.add_toggle_from_command(CMD_MENU_CYCLE_MODE);
4181 abil_menu.add_toggle_from_command(CMD_MENU_CYCLE_MODE_REVERSE);
4182 // help here amounts to describing abilities:
4183 abil_menu.add_toggle_from_command(CMD_MENU_HELP);
4184 abil_menu.menu_action = Menu::ACT_EXECUTE;
4185
4186 if (crawl_state.game_is_hints())
4187 {
4188 // XXX: This could be buggy if you manage to pick up lots and
4189 // lots of abilities during hints mode.
4190 abil_menu.set_more(hints_abilities_info());
4191 }
4192 else
4193 {
4194 abil_menu.set_more(formatted_string::parse_string(
4195 menu_keyhelp_cmd(CMD_MENU_HELP) + " toggle "
4196 "between ability selection and description."));
4197 }
4198
4199 int numbers[52];
4200 for (int i = 0; i < 52; ++i)
4201 numbers[i] = i;
4202
4203 bool found_invocations = false;
4204
4205 // First add all non-invocation abilities.
4206 for (unsigned int i = 0; i < talents.size(); ++i)
4207 {
4208 if (talents[i].is_invocation)

Callers 3

_adjust_abilityFunction · 0.85
activate_abilityFunction · 0.85

Calls 15

hints_abilities_infoFunction · 0.85
parse_stringFunction · 0.85
menu_keyhelp_cmdFunction · 0.85
describe_talentFunction · 0.85
tile_defClass · 0.85
tileidx_abilityFunction · 0.85
check_ability_possibleFunction · 0.85
redraw_screenFunction · 0.85
set_highlighterMethod · 0.80
game_is_hintsMethod · 0.80

Tested by

no test coverage detected