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

Method process_command

crawl-ref/source/spl-cast.cc:224–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222 }
223
224 bool process_command(command_type cmd) override
225 {
226 if (cmd == CMD_MENU_HELP)
227 {
228 int idx = last_hovered;
229 if (idx >= 0 && idx < static_cast<int>(items.size()))
230 {
231 examine_index(idx);
232 return true;
233 }
234 }
235
236 get_selected(&sel);
237 // if there's a preselected item, and no current selection, select it.
238 // for arrow selection, the hover starts on the preselected item so no
239 // special handling is needed.
240 if (menu_action == ACT_EXECUTE && cmd == CMD_MENU_SELECT
241 && !(flags & MF_ARROWS_SELECT) && sel.empty())
242 {
243 for (size_t i = 0; i < items.size(); ++i)
244 {
245 if (static_cast<SpellMenuEntry*>(items[i])->preselected)
246 {
247 select_index(i, 1);
248 break;
249 }
250 }
251 }
252 return ToggleableMenu::process_command(cmd);
253 }
254
255 bool examine_index(int i) override
256 {

Callers

nothing calls this directly

Calls 3

process_commandFunction · 0.70
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected