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

Method save

src/Savegame/Base.cpp:213–247  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

211 * @return YAML node.
212 */
213YAML::Node Base::save() const
214{
215 YAML::Node node = Target::save();
216 node["name"] = Language::wstrToUtf8(_name);
217 for (std::vector<BaseFacility*>::const_iterator i = _facilities.begin(); i != _facilities.end(); ++i)
218 {
219 node["facilities"].push_back((*i)->save());
220 }
221 for (std::vector<Soldier*>::const_iterator i = _soldiers.begin(); i != _soldiers.end(); ++i)
222 {
223 node["soldiers"].push_back((*i)->save());
224 }
225 for (std::vector<Craft*>::const_iterator i = _crafts.begin(); i != _crafts.end(); ++i)
226 {
227 node["crafts"].push_back((*i)->save());
228 }
229 node["items"] = _items->save();
230 node["scientists"] = _scientists;
231 node["engineers"] = _engineers;
232 node["inBattlescape"] = _inBattlescape;
233 for (std::vector<Transfer*>::const_iterator i = _transfers.begin(); i != _transfers.end(); ++i)
234 {
235 node["transfers"].push_back((*i)->save());
236 }
237 for (std::vector<ResearchProject*>::const_iterator i = _research.begin(); i != _research.end(); ++i)
238 {
239 node["research"].push_back((*i)->save());
240 }
241 for (std::vector<Production*>::const_iterator i = _productions.begin(); i != _productions.end(); ++i)
242 {
243 node["productions"].push_back((*i)->save());
244 }
245 node["retaliationTarget"] = _retaliationTarget;
246 return node;
247}
248
249/**
250 * Saves the base's unique identifiers to a YAML file.

Callers

nothing calls this directly

Calls 1

saveFunction · 0.85

Tested by

no test coverage detected