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

Method eventOccurred

game/ui/general/cheatoptions.cpp:102–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void CheatOptions::eventOccurred(Event *e)
103{
104 menuform->eventOccured(e);
105
106 if (e->type() == EVENT_KEY_DOWN)
107 {
108 if (e->keyboard().KeyCode == SDLK_ESCAPE || e->keyboard().KeyCode == SDLK_RETURN ||
109 e->keyboard().KeyCode == SDLK_KP_ENTER)
110 {
111 menuform->findControl("BUTTON_OK")->click();
112 return;
113 }
114 }
115 if (e->type() == EVENT_FORM_INTERACTION && e->forms().EventFlag == FormEventType::ButtonClick)
116 {
117 if (e->forms().RaisedBy->Name == "BUTTON_OK")
118 {
119 fw().stageQueueCommand({StageCmd::Command::POP});
120 return;
121 }
122 else if (e->forms().RaisedBy->Name == "BUTTON_GIVE_ALL_RESEARCH")
123 {
124 for (auto &r : this->state->research.topics)
125 {
126 LogWarning("Topic \"%s\"", r.first);
127 auto &topic = r.second;
128 if (topic->isComplete())
129 {
130 LogWarning("Topic \"%s\" already complete", r.first);
131 }
132 else
133 {
134 topic->forceComplete();
135 LogWarning("Topic \"%s\" marked as complete", r.first);
136 }
137 }
138 this->state->research.resortTopicList();
139 }
140 else if (e->forms().RaisedBy->Name == "BUTTON_ORGS_FRIENDLY")
141 {
142 for (auto &r : state->organisations)
143 {
144 r.second->adjustRelationTo(*state, state->player,
145 std::numeric_limits<float>::infinity());
146 }
147 }
148 else if (e->forms().RaisedBy->Name == "BUTTON_ORGS_HOSTILE")
149 {
150 for (auto &r : state->organisations)
151 {
152 r.second->adjustRelationTo(*state, state->player,
153 -std::numeric_limits<float>::infinity());
154 }
155 }
156 else if (e->forms().RaisedBy->Name == "BUTTON_ORGS_UTOPIA")
157 {
158 for (auto &r : state->organisations)
159 {

Callers

nothing calls this directly

Calls 15

formatFunction · 0.85
typeMethod · 0.80
findControlMethod · 0.80
stageQueueCommandMethod · 0.80
isCompleteMethod · 0.80
forceCompleteMethod · 0.80
resortTopicListMethod · 0.80
adjustRelationToMethod · 0.80
getOrganisationMethod · 0.80
getPlayerMethod · 0.80
getPlayerBalanceMethod · 0.80
addTicksMethod · 0.80

Tested by

no test coverage detected