MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / processEvent

Method processEvent

src/openrct2-ui/input/ShortcutManager.cpp:154–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void ShortcutManager::processEvent(const InputEvent& e)
155{
156 if (!isPendingShortcutChange())
157 {
158 for (const auto& shortcut : shortcuts)
159 {
160 if (shortcut.second.matches(e))
161 {
162 shortcut.second.action();
163 }
164 }
165 }
166 else
167 {
168 auto shortcut = getShortcut(_pendingShortcutChange);
169 if (shortcut != nullptr && shortcut->isSuitableInputEvent(e))
170 {
171 auto shortcutInput = ShortcutInput::fromInputEvent(e);
172 if (shortcutInput.has_value())
173 {
174 shortcut->current.clear();
175 shortcut->current.push_back(std::move(shortcutInput.value()));
176 }
177 _pendingShortcutChange.clear();
178
179 auto* windowMgr = GetWindowManager();
180 windowMgr->CloseByClass(WindowClass::changeKeyboardShortcut);
181 saveUserBindings();
182 }
183 }
184}
185
186bool ShortcutManager::processEventForSpecificShortcut(const InputEvent& e, std::string_view id)
187{

Callers 1

processMethod · 0.80

Calls 7

GetWindowManagerFunction · 0.85
isSuitableInputEventMethod · 0.80
valueMethod · 0.80
CloseByClassMethod · 0.80
clearMethod · 0.65
matchesMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected