Repository navigation
Expand file tree
/
Copy pathTerrorSite.cpp
More file actions
163 lines (147 loc) · 3.42 KB
/
Copy pathTerrorSite.cpp
File metadata and controls
163 lines (147 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
* Copyright 2010-2012 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TerrorSite.h"
#include <sstream>
#include "../Engine/Language.h"
namespace OpenXcom
{
/**
* Initializes a terror site.
*/
TerrorSite::TerrorSite() : Target(), _id(0), _hoursActive(-1), _inBattlescape(false)
{
}
/**
*
*/
TerrorSite::~TerrorSite()
{
}
/**
* Loads the terror site from a YAML file.
* @param node YAML node.
*/
void TerrorSite::load(const YAML::Node &node)
{
Target::load(node);
node["id"] >> _id;
node["hoursActive"] >> _hoursActive;
node["race"] >> _race;
node["inBattlescape"] >> _inBattlescape;
}
/**
* Saves the terror site to a YAML file.
* @param out YAML emitter.
*/
void TerrorSite::save(YAML::Emitter &out) const
{
Target::save(out);
out << YAML::Key << "id" << YAML::Value << _id;
out << YAML::Key << "hoursActive" << YAML::Value << _hoursActive;
out << YAML::Key << "race" << YAML::Value << _race;
out << YAML::Key << "inBattlescape" << YAML::Value << _inBattlescape;
out << YAML::EndMap;
}
/**
* Saves the terror site's unique identifiers to a YAML file.
* @param out YAML emitter.
*/
void TerrorSite::saveId(YAML::Emitter &out) const
{
Target::saveId(out);
out << YAML::Key << "type" << YAML::Value << "STR_TERROR_SITE";
out << YAML::Key << "id" << YAML::Value << _id;
out << YAML::EndMap;
}
/**
* Returns the terror site's unique ID.
* @return Unique ID.
*/
int TerrorSite::getId() const
{
return _id;
}
/**
* Changes the terror site's unique ID.
* @param id Unique ID.
*/
void TerrorSite::setId(int id)
{
_id = id;
}
/**
* Returns the terror site's unique identifying name.
* @param lang Language to get strings from.
* @return Full name.
*/
std::wstring TerrorSite::getName(Language *lang) const
{
std::wstringstream name;
name << lang->getString("STR_TERROR_SITE_UC") << _id;
return name.str();
}
/**
* Returns the amount of hours the terror site has been active for.
* @return Amount of hours.
*/
int TerrorSite::getHoursActive() const
{
return _hoursActive;
}
/**
* Changes the amount of hours the terror site has been active for.
* @param hours Amount of hours.
*/
void TerrorSite::setHoursActive(int hours)
{
_hoursActive = hours;
}
/**
* Returns the alien race currently residing in the terror site.
* @return Alien race.
*/
std::string TerrorSite::getAlienRace() const
{
return _race;
}
/**
* Changes the alien race currently residing in the terror site.
* @param race Alien race.
*/
void TerrorSite::setAlienRace(const std::string &race)
{
_race = race;
}
/**
* Gets the terror site's battlescape status.
* @return bool
*/
bool TerrorSite::isInBattlescape() const
{
return _inBattlescape;
}
/**
* Sets the terror site's battlescape status.
* @param inbattle .
*/
void TerrorSite::setInBattlescape(bool inbattle)
{
_inBattlescape = inbattle;
}
}