MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / eventOccurred

Method eventOccurred

game/ui/general/ingameoptions.cpp:251–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void InGameOptions::eventOccurred(Event *e)
252{
253 menuform->eventOccured(e);
254
255 if (e->type() == EVENT_KEY_DOWN)
256 {
257 if (e->keyboard().KeyCode == SDLK_ESCAPE || e->keyboard().KeyCode == SDLK_RETURN ||
258 e->keyboard().KeyCode == SDLK_KP_ENTER)
259 {
260 menuform->findControl("BUTTON_OK")->click();
261 return;
262 }
263 }
264
265 if (e->type() == EVENT_FORM_INTERACTION && e->forms().EventFlag == FormEventType::ButtonClick)
266 {
267 if (e->forms().RaisedBy->Name == "BUTTON_OK")
268 {
269 fw().stageQueueCommand({StageCmd::Command::POP});
270 return;
271 }
272 if (e->forms().RaisedBy->Name == "BUTTON_ABANDONGAME")
273 {
274 fw().stageQueueCommand({StageCmd::Command::REPLACEALL, mksp<MainMenu>()});
275 return;
276 }
277 if (e->forms().RaisedBy->Name == "BUTTON_QUIT")
278 {
279 fw().stageQueueCommand({StageCmd::Command::QUIT});
280 return;
281 }
282 if (e->forms().RaisedBy->Name == "BUTTON_SAVEGAME")
283 {
284 fw().stageQueueCommand(
285 {StageCmd::Command::PUSH, mksp<SaveMenu>(SaveMenuAction::Save, state)});
286 return;
287 }
288 if (e->forms().RaisedBy->Name == "BUTTON_DELETESAVEDGAME")
289 {
290 fw().stageQueueCommand(
291 {StageCmd::Command::PUSH, mksp<SaveMenu>(SaveMenuAction::Delete, state)});
292 return;
293 }
294 if (e->forms().RaisedBy->Name == "BUTTON_LOADGAME")
295 {
296 fw().stageQueueCommand(
297 {StageCmd::Command::PUSH, mksp<SaveMenu>(SaveMenuAction::Load, state)});
298 return;
299 }
300 if (e->forms().RaisedBy->Name == "BUTTON_NEXT_LIST")
301 {
302 loadNextList();
303 return;
304 }
305 if (e->forms().RaisedBy->Name == "BUTTON_CHEATS")
306 {
307 fw().stageQueueCommand({StageCmd::Command::PUSH, mksp<CheatOptions>(state)});
308 return;

Callers

nothing calls this directly

Calls 12

trFunction · 0.85
formatFunction · 0.85
typeMethod · 0.80
findControlMethod · 0.80
stageQueueCommandMethod · 0.80
killStrandedUnitsMethod · 0.80
abortMissionMethod · 0.80
getMaximumMethod · 0.80
eventOccuredMethod · 0.45
clickMethod · 0.45
getValueMethod · 0.45
setGainMethod · 0.45

Tested by

no test coverage detected