19 #include <yaml-cpp/yaml.h> 24 #include "../Engine/Language.h" 36 std::string markerName;
39 std::string region, country, type, ufo;
43 std::string alienRace;
45 std::map<int, int> injuryList;
50 void load(
const YAML::Node &node)
52 id = node[
"id"].as<
int>(
id);
53 markerName = node[
"markerName"].as<std::string>(markerName);
54 markerId = node[
"markerId"].as<
int>(markerId);
55 time.
load(node[
"time"]);
56 region = node[
"region"].as<std::string>(region);
57 country = node[
"country"].as<std::string>(country);
58 type = node[
"type"].as<std::string>(type);
59 ufo = node[
"ufo"].as<std::string>(ufo);
60 success = node[
"success"].as<
bool>(success);
61 score = node[
"score"].as<
int>(score);
62 rating = node[
"rating"].as<std::string>(rating);
63 alienRace = node[
"alienRace"].as<std::string>(alienRace);
64 daylight = node[
"daylight"].as<
int>(daylight);
65 injuryList = node[
"injuryList"].as< std::map<int, int> >(injuryList);
66 valiantCrux = node[
"valiantCrux"].as<
bool>(valiantCrux);
67 lootValue = node[
"lootValue"].as<
int>(lootValue);
71 YAML::Node save()
const 75 if (!markerName.empty())
77 node[
"markerName"] = markerName;
78 node[
"markerId"] = markerId;
80 node[
"time"] = time.
save();
81 node[
"region"] = region;
82 node[
"country"] = country;
85 node[
"success"] = success;
86 node[
"score"] = score;
87 node[
"rating"] = rating;
88 node[
"alienRace"] = alienRace;
89 node[
"daylight"] = daylight;
90 node[
"injuryList"] = injuryList;
91 if (valiantCrux) node[
"valiantCrux"] = valiantCrux;
92 if (lootValue) node[
"lootValue"] = lootValue;
96 std::wstring getMissionName(
Language *lang)
const 98 if (!markerName.empty())
108 std::wstring getRatingString(
Language *lang)
const 110 std::wostringstream ss;
123 std::string getLocationString()
const 125 if (country ==
"STR_UNKNOWN")
135 std::string getDaylightString()
const 147 bool isAlienBase()
const 149 if (type.find(
"STR_ALIEN_BASE") != std::string::npos || type.find(
"STR_ALIEN_COLONY") != std::string::npos)
156 bool isBaseDefense()
const 158 if (type ==
"STR_BASE_DEFENSE")
165 bool isUfoMission()
const 174 MissionStatistics(
const YAML::Node& node) : time(0, 0, 0, 0, 0, 0, 0) { load(node); }
175 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) { }
int id
Variables.
Definition: MissionStatistics.h:35
void load(const YAML::Node &node)
Loads the time from YAML.
Definition: GameTime.cpp:50
Contains strings used throughout the game for localization.
Definition: Language.h:39
LocalizedText arg(const std::wstring &) const OX_REQUIRED_RESULT
Replace next argument.
Definition: LocalizedText.cpp:30
const LocalizedText & getString(const std::string &id) const
Get a localized text.
Definition: Language.cpp:487
Stores the current ingame time/date according to GMT.
Definition: GameTime.h:38
Container for mission statistics.
Definition: MissionStatistics.h:32
YAML::Node save() const
Saves the time to YAML.
Definition: GameTime.cpp:65
Definition: BaseInfoState.cpp:40