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

Method load

src/Savegame/AlienMission.cpp:76–96  ·  view source on GitHub ↗

* @param node The YAML node containing the data. * @param game The game data, required to locate the alien base. */

Source from the content-addressed store, hash-verified

74 * @param game The game data, required to locate the alien base.
75 */
76void AlienMission::load(const YAML::Node& node, SavedGame &game)
77{
78 _region = node["region"].as<std::string>(_region);
79 _race = node["race"].as<std::string>(_race);
80 _nextWave = node["nextWave"].as<size_t>(_nextWave);
81 _nextUfoCounter = node["nextUfoCounter"].as<size_t>(_nextUfoCounter);
82 _spawnCountdown = node["spawnCountdown"].as<size_t>(_spawnCountdown);
83 _liveUfos = node["liveUfos"].as<size_t>(_liveUfos);
84 _uniqueID = node["uniqueID"].as<int>(_uniqueID);
85 if (const YAML::Node &base = node["alienBase"])
86 {
87 int id = base.as<int>();
88 std::vector<AlienBase*>::const_iterator found = std::find_if(game.getAlienBases()->begin(), game.getAlienBases()->end(), matchById(id));
89 if (found == game.getAlienBases()->end())
90 {
91 throw Exception("Corrupted save: Invalid base for mission.");
92 }
93 _base = *found;
94 }
95
96}
97
98YAML::Node AlienMission::save() const
99{

Callers

nothing calls this directly

Calls 3

matchByIdClass · 0.85
ExceptionClass · 0.85
getAlienBasesMethod · 0.80

Tested by

no test coverage detected