* Determine the alien missions to start this month. * In the vanilla game each month a terror mission and one other are started in * random regions. */
| 2153 | * random regions. |
| 2154 | */ |
| 2155 | void GeoscapeState::determineAlienMissions(bool atGameStart) |
| 2156 | { |
| 2157 | if (!atGameStart) |
| 2158 | { |
| 2159 | // |
| 2160 | // One randomly selected mission. |
| 2161 | // |
| 2162 | AlienStrategy &strategy = _game->getSavedGame()->getAlienStrategy(); |
| 2163 | const std::string &targetRegion = strategy.chooseRandomRegion(_game->getRuleset()); |
| 2164 | const std::string &targetMission = strategy.chooseRandomMission(targetRegion); |
| 2165 | // Choose race for this mission. |
| 2166 | const RuleAlienMission &missionRules = *_game->getRuleset()->getAlienMission(targetMission); |
| 2167 | const std::string &missionRace = missionRules.generateRace(_game->getSavedGame()->getMonthsPassed()); |
| 2168 | AlienMission *otherMission = new AlienMission(missionRules); |
| 2169 | otherMission->setId(_game->getSavedGame()->getId("ALIEN_MISSIONS")); |
| 2170 | otherMission->setRegion(targetRegion, *_game->getRuleset()); |
| 2171 | otherMission->setRace(missionRace); |
| 2172 | otherMission->start(); |
| 2173 | _game->getSavedGame()->getAlienMissions().push_back(otherMission); |
| 2174 | // Make sure this combination never comes up again. |
| 2175 | strategy.removeMission(targetRegion, targetMission); |
| 2176 | } |
| 2177 | else |
| 2178 | { |
| 2179 | // |
| 2180 | // Sectoid Research at base's region. |
| 2181 | // |
| 2182 | AlienStrategy &strategy = _game->getSavedGame()->getAlienStrategy(); |
| 2183 | std::string targetRegion = |
| 2184 | _game->getSavedGame()->locateRegion(*_game->getSavedGame()->getBases()->front())->getRules()->getType(); |
| 2185 | // Choose race for this mission. |
| 2186 | std::string research = _game->getRuleset()->getAlienMissionList().front(); |
| 2187 | const RuleAlienMission &missionRules = *_game->getRuleset()->getAlienMission(research); |
| 2188 | AlienMission *otherMission = new AlienMission(missionRules); |
| 2189 | otherMission->setId(_game->getSavedGame()->getId("ALIEN_MISSIONS")); |
| 2190 | otherMission->setRegion(targetRegion, *_game->getRuleset()); |
| 2191 | std::string sectoid = missionRules.getTopRace(_game->getSavedGame()->getMonthsPassed()); |
| 2192 | otherMission->setRace(sectoid); |
| 2193 | otherMission->start(150); |
| 2194 | _game->getSavedGame()->getAlienMissions().push_back(otherMission); |
| 2195 | // Make sure this combination never comes up again. |
| 2196 | strategy.removeMission(targetRegion, research); |
| 2197 | } |
| 2198 | } |
| 2199 | |
| 2200 | void GeoscapeState::setupTerrorMission() |
| 2201 | { |
nothing calls this directly
no test coverage detected