22 #include <yaml-cpp/yaml.h> 24 #include "../Savegame/WeightedOptions.h" 35 double lonMin, lonMax, latMin, latMax;
41 return AreSame(lonMax, ma.lonMax) && AreSame(lonMin, ma.lonMin) && AreSame(latMax, ma.latMax) && AreSame(latMin, ma.latMin);
46 return AreSame(lonMin, lonMax) && AreSame(latMin, latMax);
55 std::vector<MissionArea> areas;
59 areas.swap(other.areas);
76 std::vector<double> _lonMin, _lonMax, _latMin, _latMax;
77 std::vector<City*> _cities;
83 std::vector<MissionZone> _missionZones;
85 std::string _missionRegion;
92 void load(
const YAML::Node& node);
94 std::string getType()
const;
96 int getBaseCost()
const;
98 bool insideRegion(
double lon,
double lat)
const;
100 std::vector<City*> *getCities();
102 size_t getWeight()
const;
108 std::pair<double, double> getRandomPoint(
size_t zone)
const;
112 MissionArea getRandomMissionPoint(
size_t zone)
const;
114 const std::vector<double> &
getLonMax()
const {
return _lonMax; }
116 const std::vector<double> &
getLonMin()
const {
return _lonMin; }
118 const std::vector<double> &
getLatMax()
const {
return _latMax; }
120 const std::vector<double> &
getLatMin()
const {
return _latMin; }
122 const std::vector<MissionZone> &getMissionZones()
const;
135 node.push_back(rhs.lonMin / M_PI * 180.0);
136 node.push_back(rhs.lonMax / M_PI * 180.0);
137 node.push_back(rhs.latMin / M_PI * 180.0);
138 node.push_back(rhs.latMax / M_PI * 180.0);
144 if (!node.IsSequence() || node.size() < 4)
147 rhs.lonMin = node[0].as<
double>() * M_PI / 180.0;
148 rhs.lonMax = node[1].as<
double>() * M_PI / 180.0;
149 rhs.latMin = node[2].as<
double>() * M_PI / 180.0;
150 rhs.latMax = node[3].as<
double>() * M_PI / 180.0;
151 if (rhs.latMin > rhs.latMax)
152 std::swap(rhs.latMin, rhs.latMax);
153 if (node.size() >= 5) rhs.texture = node[4].as<
int>();
154 if (node.size() >= 6) rhs.name = node[5].as<std::string>();
171 if (!node.IsSequence())
174 rhs.areas = node.as< std::vector<OpenXcom::MissionArea> >(rhs.areas);
const std::vector< double > & getLatMin() const
Gets the minimum latitude.
Definition: RuleRegion.h:120
const std::vector< double > & getLonMin() const
Gets the minimum longitude.
Definition: RuleRegion.h:116
Defines a rectangle in polar coordinates.
Definition: RuleRegion.h:33
A zone (set of areas) on the globe.
Definition: RuleRegion.h:53
const std::vector< double > & getLatMax() const
Gets the maximum latitude.
Definition: RuleRegion.h:118
const std::vector< double > & getLonMax() const
Gets the maximum longitude.
Definition: RuleRegion.h:114
Definition: Position.h:88
Represents a city of the world.
Definition: City.h:32
const WeightedOptions & getAvailableMissions() const
Gets the weighted list of missions for this region.
Definition: RuleRegion.h:104
const std::string & getMissionRegion() const
Gets the substitute mission region.
Definition: RuleRegion.h:106
Holds pairs of relative weights and IDs.
Definition: WeightedOptions.h:33
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:33
Represents a specific region of the world.
Definition: RuleRegion.h:71
Definition: BaseInfoState.cpp:40