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