* Saves the UFO to a YAML file. * @return YAML node. */
| 172 | * @return YAML node. |
| 173 | */ |
| 174 | YAML::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. |