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

Method eventOccurred

game/ui/base/researchscreen.cpp:171–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169void ResearchScreen::finish() {}
170
171void ResearchScreen::eventOccurred(Event *e)
172{
173 form->eventOccured(e);
174
175 if (e->type() == EVENT_KEY_DOWN)
176 {
177 if (e->keyboard().KeyCode == SDLK_ESCAPE || e->keyboard().KeyCode == SDLK_RETURN ||
178 e->keyboard().KeyCode == SDLK_KP_ENTER)
179 {
180 form->findControl("BUTTON_OK")->click();
181 return;
182 }
183 }
184 // DEBUG
185 if (e->type() == EVENT_KEY_DOWN)
186 {
187 switch (e->keyboard().KeyCode)
188 {
189 case SDLK_F10:
190 {
191 if (current_topic)
192 {
193 switch (this->viewFacility->lab->current_project->type)
194 {
195 case ResearchTopic::Type::BioChem:
196 case ResearchTopic::Type::Physics:
197 current_topic->man_hours_progress = current_topic->man_hours - 1;
198 break;
199 case ResearchTopic::Type::Engineering:
200 viewFacility->lab->manufacture_man_hours_invested =
201 current_topic->man_hours *
202 this->viewFacility->lab->manufacture_goal;
203 break;
204 default:
205 LogError("Unknown lab type");
206 break;
207 }
208 updateProgressInfo();
209 }
210 return;
211 }
212 }
213 }
214
215 if (e->type() == EVENT_MOUSE_MOVE)
216 {
217 arrow->setVisible(!(e->mouse().X > arrow->getLocationOnScreen().x));
218 }
219
220 if (e->type() == EVENT_FORM_INTERACTION)
221 {
222 if (e->forms().EventFlag == FormEventType::ButtonClick)
223 {
224 if (e->forms().RaisedBy->Name == "BUTTON_OK")
225 {
226 fw().stageQueueCommand({StageCmd::Command::POP});
227 return;
228 }

Callers

nothing calls this directly

Calls 12

updateProgressInfoMethod · 0.95
typeMethod · 0.80
findControlMethod · 0.80
getLocationOnScreenMethod · 0.80
stageQueueCommandMethod · 0.80
getPlayerBalanceMethod · 0.80
eventOccuredMethod · 0.45
clickMethod · 0.45
setVisibleMethod · 0.45
getMethod · 0.45
setTextMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected