* Spawn an alien base. * @param globe The earth globe, required to get access to land checks. * @param engine The game engine, required to get access to game data and game rules. */
| 632 | * @param engine The game engine, required to get access to game data and game rules. |
| 633 | */ |
| 634 | void AlienMission::spawnAlienBase(const Globe &globe, Game &engine) |
| 635 | { |
| 636 | SavedGame &game = *engine.getSavedGame(); |
| 637 | if (game.getAlienBases()->size() >= 8) |
| 638 | { |
| 639 | return; |
| 640 | } |
| 641 | const Ruleset &ruleset = *engine.getRuleset(); |
| 642 | // Once the last UFO is spawned, the aliens build their base. |
| 643 | const RuleRegion ®ionRules = *ruleset.getRegion(_region); |
| 644 | std::pair<double, double> pos = getLandPoint(globe, regionRules, RuleRegion::ALIEN_BASE_ZONE); |
| 645 | AlienBase *ab = new AlienBase(); |
| 646 | ab->setAlienRace(_race); |
| 647 | ab->setId(game.getId("STR_ALIEN_BASE")); |
| 648 | ab->setLongitude(pos.first); |
| 649 | ab->setLatitude(pos.second); |
| 650 | game.getAlienBases()->push_back(ab); |
| 651 | addScore(pos.first, pos.second, engine); |
| 652 | } |
| 653 | |
| 654 | /* |
| 655 | * Sets the mission's region. if the region is incompatible with |
nothing calls this directly
no test coverage detected