| 1036 | } |
| 1037 | std::string getFocusString() { return "unitlabors/profession"; } |
| 1038 | void feed(set<df::interface_key> *events) |
| 1039 | { |
| 1040 | if (events->count(interface_key::LEAVESCREEN)) |
| 1041 | { |
| 1042 | Screen::dismiss(this); |
| 1043 | return; |
| 1044 | } |
| 1045 | if (menu_options.feed(events)) |
| 1046 | { |
| 1047 | // Allow left mouse button to trigger menu options |
| 1048 | if (menu_options.feed_mouse_set_highlight) |
| 1049 | events->insert(interface_key::SELECT); |
| 1050 | else |
| 1051 | return; |
| 1052 | } |
| 1053 | if (events->count(interface_key::SELECT)) |
| 1054 | { |
| 1055 | if (menu_options.hasSelection()) |
| 1056 | { |
| 1057 | select_profession(menu_options.getFirstSelectedElem()); |
| 1058 | } |
| 1059 | Screen::dismiss(this); |
| 1060 | return; |
| 1061 | } |
| 1062 | } |
| 1063 | void select_profession(size_t selected) |
| 1064 | { |
| 1065 | if (manager.templates.empty() || selected >= manager.templates.size()) |
nothing calls this directly
no test coverage detected