| 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 | { |
nothing calls this directly
no test coverage detected