MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / spawnAlienBase

Method spawnAlienBase

src/Savegame/AlienMission.cpp:634–652  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

632 * @param engine The game engine, required to get access to game data and game rules.
633 */
634void 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 &regionRules = *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

Callers

nothing calls this directly

Calls 9

getSavedGameMethod · 0.80
getAlienBasesMethod · 0.80
getRegionMethod · 0.80
getRulesetMethod · 0.45
setAlienRaceMethod · 0.45
setIdMethod · 0.45
getIdMethod · 0.45
setLongitudeMethod · 0.45
setLatitudeMethod · 0.45

Tested by

no test coverage detected