20 #include <yaml-cpp/yaml.h> 25 #include "../Engine/Language.h" 37 std::string markerName;
40 std::string region, country, type, ufo;
44 std::string alienRace;
46 std::map<int, int> injuryList;
51 void load(
const YAML::Node &node)
53 id = node[
"id"].as<
int>(id);
54 markerName = node[
"markerName"].as<std::string>(markerName);
55 markerId = node[
"markerId"].as<
int>(markerId);
56 time.
load(node[
"time"]);
57 region = node[
"region"].as<std::string>(region);
58 country = node[
"country"].as<std::string>(country);
59 type = node[
"type"].as<std::string>(type);
60 ufo = node[
"ufo"].as<std::string>(ufo);
61 success = node[
"success"].as<
bool>(success);
62 score = node[
"score"].as<
int>(score);
63 rating = node[
"rating"].as<std::string>(rating);
64 alienRace = node[
"alienRace"].as<std::string>(alienRace);
65 daylight = node[
"daylight"].as<
int>(daylight);
66 injuryList = node[
"injuryList"].as< std::map<int, int> >(injuryList);
67 valiantCrux = node[
"valiantCrux"].as<
bool>(valiantCrux);
68 lootValue = node[
"lootValue"].as<
int>(lootValue);
76 if (!markerName.empty())
78 node[
"markerName"] = markerName;
79 node[
"markerId"] = markerId;
81 node[
"time"] = time.
save();
82 node[
"region"] = region;
83 node[
"country"] = country;
86 node[
"success"] = success;
87 node[
"score"] = score;
88 node[
"rating"] = rating;
89 node[
"alienRace"] = alienRace;
90 node[
"daylight"] = daylight;
91 node[
"injuryList"] = injuryList;
92 if (valiantCrux) node[
"valiantCrux"] = valiantCrux;
93 if (lootValue) node[
"lootValue"] = lootValue;
97 std::string getMissionName(
Language *lang)
const 99 if (!markerName.empty())
109 std::string getRatingString(Language *lang)
const 111 std::ostringstream ss;
114 ss << lang->getString(
"STR_VICTORY");
118 ss << lang->getString(
"STR_DEFEAT");
120 ss <<
" - " << lang->getString(rating);
124 std::string getLocationString()
const 126 if (country ==
"STR_UNKNOWN")
136 std::string getDaylightString()
const 148 bool isAlienBase()
const 150 if (type.find(
"STR_ALIEN_BASE") != std::string::npos || type.find(
"STR_ALIEN_COLONY") != std::string::npos)
157 bool isBaseDefense()
const 159 if (type ==
"STR_BASE_DEFENSE")
166 bool isUfoMission()
const 175 MissionStatistics(
const YAML::Node& node) : time(0, 0, 0, 0, 0, 0, 0) {
load(node); }
176 MissionStatistics() : id(0), markerId(0), time(0, 0, 0, 0, 0, 0, 0), region(
"STR_REGION_UNKNOWN"), country(
"STR_UNKNOWN"), ufo(
"NO_UFO"), success(false), score(0), alienRace(
"STR_UNKNOWN"), daylight(0), valiantCrux(false), lootValue(0) { }
177 ~MissionStatistics() { }
YAML::Node save() const
Save.
Definition: MissionStatistics.h:72
void load(const YAML::Node &node)
Loads the time from YAML.
Definition: GameTime.cpp:50
void load(const YAML::Node &node)
Load.
Definition: MissionStatistics.h:51
LocalizedText arg(const std::string &) const OX_REQUIRED_RESULT
Replace next argument.
Definition: LocalizedText.cpp:30
Contains strings used throughout the game for localization.
Definition: Language.h:39
const LocalizedText & getString(const std::string &id) const
Get a localized text.
Definition: Language.cpp:275
Stores the current ingame time/date according to GMT.
Definition: GameTime.h:38
Container for mission statistics.
Definition: MissionStatistics.h:33
YAML::Node save() const
Saves the time to YAML.
Definition: GameTime.cpp:65
Definition: BaseInfoState.cpp:40