OpenXcom  1.0
Open-source clone of the original X-Com
RuleCraft.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 <vector>
21 #include <string>
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
26 
27 class RuleTerrain;
28 class Mod;
29 
36 class RuleCraft
37 {
38 private:
39  std::string _type;
40  std::vector<std::string> _requires;
41  int _sprite, _marker;
42  int _fuelMax, _damageMax, _speedMax, _accel, _weapons, _soldiers, _vehicles, _costBuy, _costRent, _costSell;
43  std::string _refuelItem;
44  int _repairRate, _refuelRate, _radarRange, _radarChance, _sightRange, _transferTime, _score;
45  RuleTerrain *_battlescapeTerrainData;
46  bool _spacecraft;
47  int _listOrder, _maxItems, _maxAltitude;
48  std::vector<std::vector <int> > _deployment;
49 public:
51  RuleCraft(const std::string &type);
53  ~RuleCraft();
55  void load(const YAML::Node& node, Mod *mod, int listOrder);
57  std::string getType() const;
59  const std::vector<std::string> &getRequirements() const;
61  int getSprite() const;
63  int getMarker() const;
65  int getMaxFuel() const;
67  int getMaxDamage() const;
69  int getMaxSpeed() const;
71  int getAcceleration() const;
73  unsigned int getWeapons() const;
75  int getSoldiers() const;
77  int getVehicles() const;
79  int getBuyCost() const;
81  int getRentCost() const;
83  int getSellCost() const;
85  std::string getRefuelItem() const;
87  int getRepairRate() const;
89  int getRefuelRate() const;
91  int getRadarRange() const;
93  inline int getRadarChance() const {return _radarChance;}
95  int getSightRange() const;
97  int getTransferTime() const;
99  int getScore() const;
103  bool getSpacecraft() const;
105  int getListOrder() const;
107  std::vector<std::vector<int> > &getDeployment();
109  int getMaxItems() const;
111  int getMaxAltitude() const;
113  bool isWaterOnly() const;
114 };
115 
116 }
void load(const YAML::Node &node, Mod *mod, int listOrder)
Loads craft data from YAML.
Definition: RuleCraft.cpp:51
unsigned int getWeapons() const
Gets the craft&#39;s weapon capacity.
Definition: RuleCraft.cpp:181
int getRentCost() const
Gets the craft&#39;s rent for a month.
Definition: RuleCraft.cpp:220
int getMaxFuel() const
Gets the craft&#39;s maximum fuel.
Definition: RuleCraft.cpp:141
int getMaxDamage() const
Gets the craft&#39;s maximum damage.
Definition: RuleCraft.cpp:151
int getSightRange() const
Gets the craft&#39;s sight range.
Definition: RuleCraft.cpp:280
int getRepairRate() const
Gets the craft&#39;s repair rate.
Definition: RuleCraft.cpp:250
int getSellCost() const
Gets the craft&#39;s value.
Definition: RuleCraft.cpp:230
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
int getMaxSpeed() const
Gets the craft&#39;s maximum speed.
Definition: RuleCraft.cpp:161
bool isWaterOnly() const
Gets if this craft only fights on water.
Definition: RuleCraft.cpp:364
std::string getType() const
Gets the craft&#39;s type.
Definition: RuleCraft.cpp:103
int getRadarRange() const
Gets the craft&#39;s radar range.
Definition: RuleCraft.cpp:270
~RuleCraft()
Cleans up the craft ruleset.
Definition: RuleCraft.cpp:39
int getSprite() const
Gets the craft&#39;s sprite.
Definition: RuleCraft.cpp:123
int getScore() const
Gets the craft&#39;s score.
Definition: RuleCraft.cpp:300
int getListOrder() const
Gets the list weight for this craft.
Definition: RuleCraft.cpp:327
int getBuyCost() const
Gets the craft&#39;s cost.
Definition: RuleCraft.cpp:211
std::string getRefuelItem() const
Gets the craft&#39;s refuel item.
Definition: RuleCraft.cpp:240
RuleTerrain * getBattlescapeTerrainData()
Gets the craft&#39;s terrain data.
Definition: RuleCraft.cpp:309
bool getSpacecraft() const
Checks if this craft is capable of travelling to mars.
Definition: RuleCraft.cpp:318
RuleCraft(const std::string &type)
Creates a blank craft ruleset.
Definition: RuleCraft.cpp:31
Represents a specific type of craft.
Definition: RuleCraft.h:36
int getRefuelRate() const
Gets the craft&#39;s refuel rate.
Definition: RuleCraft.cpp:260
int getRadarChance() const
Gets the craft&#39;s radar chance.
Definition: RuleCraft.h:93
int getMaxItems() const
Gets the item limit for this craft.
Definition: RuleCraft.cpp:345
int getVehicles() const
Gets the craft&#39;s vehicle capacity.
Definition: RuleCraft.cpp:201
int getSoldiers() const
Gets the craft&#39;s soldier capacity.
Definition: RuleCraft.cpp:191
Represents a specific type of Battlescape Terrain.
Definition: RuleTerrain.h:39
int getTransferTime() const
Gets the craft&#39;s transfer time.
Definition: RuleCraft.cpp:290
int getMaxAltitude() const
Gets how high this craft can go.
Definition: RuleCraft.cpp:354
std::vector< std::vector< int > > & getDeployment()
Gets the deployment priority for the craft.
Definition: RuleCraft.cpp:336
const std::vector< std::string > & getRequirements() const
Gets the craft&#39;s requirements.
Definition: RuleCraft.cpp:113
int getMarker() const
Gets the craft&#39;s globe marker.
Definition: RuleCraft.cpp:132
int getAcceleration() const
Gets the craft&#39;s acceleration.
Definition: RuleCraft.cpp:171
Definition: BaseInfoState.cpp:40