void Production::save(YAML::Emitter &out) { out << YAML::BeginMap; out << YAML::Key << "item" << YAML::Value << getRules ()->getName (); out << YAML::Key << "assigned" << YAML::Value << getAssignedEngineers (); out << YAML::Key << "spent" << YAML::Value << getTimeSpent (); out << YAML::Key << "amount" << YAML::Value << getAmountTotal (); out << YAML::EndMap; }
YAML::Node Production::save() const { YAML::Node node; node["item"] = getRules ()->getName (); node["assigned"] = getAssignedEngineers (); node["spent"] = getTimeSpent (); node["amount"] = getAmountTotal (); return node; }
YAML::Node Production::save() const { YAML::Node node; node["item"] = getRules()->getName(); node["assigned"] = getAssignedEngineers(); node["spent"] = getTimeSpent(); node["amount"] = getAmountTotal(); node["infinite"] = getInfiniteAmount(); if (getSellItems()) node["sell"] = getSellItems(); return node; }
void Production::load(const YAML::Node &node) { setAssignedEngineers(node["assigned"].as<int>(getAssignedEngineers())); setTimeSpent(node["spent"].as<int>(getTimeSpent())); setAmountTotal(node["amount"].as<int>(getAmountTotal())); setInfiniteAmount(node["infinite"].as<bool>(getInfiniteAmount())); setSellItems(node["sell"].as<bool>(getSellItems())); // backwards compatibility if (getAmountTotal() == INT_MAX) { setAmountTotal(999); setInfiniteAmount(true); setSellItems(true); } }