| 100 | } |
| 101 | |
| 102 | void 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 | { |
nothing calls this directly
no test coverage detected