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

Method save

src/Savegame/Ufo.cpp:174–206  ·  view source on GitHub ↗

* Saves the UFO to a YAML file. * @return YAML node. */

Source from the content-addressed store, hash-verified

172 * @return YAML node.
173 */
174YAML::Node Ufo::save(bool newBattle) const
175{
176 YAML::Node node = MovingTarget::save();
177 node["type"] = _rules->getType();
178 node["id"] = _id;
179 if (_crashId)
180 {
181 node["crashId"] = _crashId;
182 }
183 else if (_landId)
184 {
185 node["landId"] = _landId;
186 }
187 node["damage"] = _damage;
188 node["altitude"] = _altitude;
189 node["direction"] = _direction;
190 node["status"] = (int)_status;
191 if (_detected)
192 node["detected"] = _detected;
193 if (_hyperDetected)
194 node["hyperDetected"] = _hyperDetected;
195 if (_secondsRemaining)
196 node["secondsRemaining"] = _secondsRemaining;
197 if (_inBattlescape)
198 node["inBattlescape"] = _inBattlescape;
199 if (!newBattle)
200 {
201 node["mission"] = _mission->getId();
202 node["trajectory"] = _trajectory->getID();
203 node["trajectoryPoint"] = _trajectoryPoint;
204 }
205 return node;
206}
207
208/**
209 * Saves the UFO's unique identifiers to a YAML file.

Callers

nothing calls this directly

Calls 4

saveFunction · 0.85
getIDMethod · 0.80
getTypeMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected