OpenXcom  1.0
Open-source clone of the original X-Com
RuleCountry.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <yaml-cpp/yaml.h>
22 
23 namespace OpenXcom
24 {
25 
32 {
33 private:
34  std::string _type;
35  int _fundingBase, _fundingCap;
36  double _labelLon, _labelLat;
37  std::vector<double> _lonMin, _lonMax, _latMin, _latMax;
38 public:
40  RuleCountry(const std::string &type);
42  ~RuleCountry();
44  void load(const YAML::Node& node);
46  std::string getType() const;
48  int generateFunding() const;
50  int getFundingCap() const;
52  double getLabelLongitude() const;
54  double getLabelLatitude() const;
56  bool insideCountry(double lon, double lat) const;
57  const std::vector<double> &getLonMax() const { return _lonMax; }
58  const std::vector<double> &getLonMin() const { return _lonMin; }
59  const std::vector<double> &getLatMax() const { return _latMax; }
60  const std::vector<double> &getLatMin() const { return _latMin; }
61 };
62 
63 }
~RuleCountry()
Cleans up the country ruleset.
Definition: RuleCountry.cpp:38
void load(const YAML::Node &node)
Loads the country from YAML.
Definition: RuleCountry.cpp:46
int getFundingCap() const
Gets the country&#39;s funding cap.
Definition: RuleCountry.cpp:94
RuleCountry(const std::string &type)
Creates a blank country ruleset.
Definition: RuleCountry.cpp:31
int generateFunding() const
Generates the country&#39;s starting funding.
Definition: RuleCountry.cpp:84
double getLabelLongitude() const
Gets the country&#39;s label X position.
Definition: RuleCountry.cpp:103
Represents a specific funding country.
Definition: RuleCountry.h:31
double getLabelLatitude() const
Gets the country&#39;s label Y position.
Definition: RuleCountry.cpp:112
std::string getType() const
Gets the country&#39;s type.
Definition: RuleCountry.cpp:75
bool insideCountry(double lon, double lat) const
Checks if a point is inside the country.
Definition: RuleCountry.cpp:123
Definition: BaseInfoState.cpp:40