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_RULECRAFT_H 20 #define OPENXCOM_RULECRAFT_H 21 22 #include <vector> 23 #include <string> 24 #include <yaml-cpp/yaml.h> 25 26 namespace OpenXcom 27 { 28 29 class RuleTerrain; 30 class Ruleset; 31 32 /** 33 * Represents a specific type of craft. 34 * Contains constant info about a craft like 35 * costs, speed, capacities, consumptions, etc. 36 * @sa Craft 37 */ 38 class RuleCraft 39 { 40 private: 41 std::string _type; 42 std::vector<std::string> _requires; 43 int _sprite; 44 int _fuelMax, _damageMax, _speedMax, _accel, _weapons, _soldiers, _vehicles, _costBuy, _costRent, _costSell; 45 std::string _refuelItem; 46 int _repairRate, _refuelRate, _radarRange, _transferTime, _score; 47 RuleTerrain *_battlescapeTerrainData; 48 bool _spacecraft; 49 int _listOrder; 50 std::vector<std::vector <int> > _deployment; 51 public: 52 /// Creates a blank craft ruleset. 53 RuleCraft(const std::string &type); 54 /// Cleans up the craft ruleset. 55 ~RuleCraft(); 56 /// Loads craft data from YAML. 57 void load(const YAML::Node& node, Ruleset *ruleset, int modIndex, int nextCraftIndex); 58 /// Gets the craft's type. 59 std::string getType() const; 60 /// Gets the craft's requirements. 61 const std::vector<std::string> &getRequirements () const; 62 /// Gets the craft's sprite. 63 int getSprite() const; 64 /// Gets the craft's maximum fuel. 65 int getMaxFuel() const; 66 /// Gets the craft's maximum damage. 67 int getMaxDamage() const; 68 /// Gets the craft's maximum speed. 69 int getMaxSpeed() const; 70 /// Gets the craft's acceleration. 71 int getAcceleration() const; 72 /// Gets the craft's weapon capacity. 73 int getWeapons() const; 74 /// Gets the craft's soldier capacity. 75 int getSoldiers() const; 76 /// Gets the craft's vehicle capacity. 77 int getVehicles() const; 78 /// Gets the craft's cost. 79 int getBuyCost() const; 80 /// Gets the craft's rent for a month. 81 int getRentCost() const; 82 /// Gets the craft's value. 83 int getSellCost() const; 84 /// Gets the craft's refuel item. 85 std::string getRefuelItem() const; 86 /// Gets the craft's repair rate. 87 int getRepairRate() const; 88 /// Gets the craft's refuel rate. 89 int getRefuelRate() const; 90 /// Gets the craft's radar range. 91 int getRadarRange() const; 92 /// Gets the craft's transfer time. 93 int getTransferTime() const; 94 /// Gets the craft's score. 95 int getScore() const; 96 /// Gets the craft's terrain data. 97 RuleTerrain *getBattlescapeTerrainData(); 98 /// Checks if this craft is capable of travelling to mars. 99 bool getSpacecraft() const; 100 /// Gets the list weight for this craft. 101 int getListOrder() const; 102 /// Gets the deployment priority for the craft. 103 std::vector<std::vector<int> > &getDeployment(); 104 }; 105 106 } 107 108 #endif 109