OpenXcom  1.0
Open-source clone of the original X-Com
RuleSoldier.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 #include "Unit.h"
23 
24 namespace OpenXcom
25 {
26 
27 class Mod;
28 class SoldierNamePool;
29 
36 {
37 private:
38  std::string _type;
39  std::vector<std::string> _requires;
40  UnitStats _minStats, _maxStats, _statCaps;
41  std::string _armor;
42  int _costBuy, _costSalary, _standHeight, _kneelHeight, _floatHeight, _femaleFrequency;
43  std::vector<int> _deathSoundMale, _deathSoundFemale;
44  std::vector<SoldierNamePool*> _names;
45 
46  void addSoldierNamePool(const std::string &namFile);
47 public:
49  RuleSoldier(const std::string &type);
51  ~RuleSoldier();
53  void load(const YAML::Node& node, Mod *mod);
55  std::string getType() const;
57  const std::vector<std::string> &getRequirements() const;
59  UnitStats getMinStats() const;
61  UnitStats getMaxStats() const;
63  UnitStats getStatCaps() const;
65  int getBuyCost() const;
67  int getSalaryCost() const;
69  int getStandHeight() const;
71  int getKneelHeight() const;
73  int getFloatHeight() const;
75  std::string getArmor() const;
77  int getFemaleFrequency() const;
79  const std::vector<int> &getMaleDeathSounds() const;
81  const std::vector<int> &getFemaleDeathSounds() const;
83  const std::vector<SoldierNamePool*> &getNames() const;
84 };
85 
86 }
RuleSoldier(const std::string &type)
Creates a blank soldier ruleset.
Definition: RuleSoldier.cpp:32
int getSalaryCost() const
Gets the monthly salary of the soldier.
Definition: RuleSoldier.cpp:199
int getFloatHeight() const
Gets the elevation of the soldier when it&#39;s flying.
Definition: RuleSoldier.cpp:226
~RuleSoldier()
Cleans up the soldier ruleset.
Definition: RuleSoldier.cpp:39
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
void load(const YAML::Node &node, Mod *mod)
Loads the soldier data from YAML.
Definition: RuleSoldier.cpp:52
const std::vector< int > & getFemaleDeathSounds() const
Gets the soldier&#39;s female death sounds.
Definition: RuleSoldier.cpp:262
int getStandHeight() const
Gets the height of the soldier when it&#39;s standing.
Definition: RuleSoldier.cpp:208
UnitStats getMaxStats() const
Gets the maximum stats for the random stats generator.
Definition: RuleSoldier.cpp:172
const std::vector< int > & getMaleDeathSounds() const
Gets the soldier&#39;s male death sounds.
Definition: RuleSoldier.cpp:253
This struct holds some plain unit attribute data together.
Definition: Unit.h:30
int getBuyCost() const
Gets the cost of the soldier.
Definition: RuleSoldier.cpp:190
const std::vector< std::string > & getRequirements() const
Gets the soldier&#39;s requirements.
Definition: RuleSoldier.cpp:154
Represents the creation data for an X-COM unit.
Definition: RuleSoldier.h:35
UnitStats getStatCaps() const
Gets the stat caps.
Definition: RuleSoldier.cpp:181
const std::vector< SoldierNamePool * > & getNames() const
Gets the pool list for soldier names.
Definition: RuleSoldier.cpp:271
std::string getType() const
Gets the soldier&#39;s type.
Definition: RuleSoldier.cpp:144
int getKneelHeight() const
Gets the height of the soldier when it&#39;s kneeling.
Definition: RuleSoldier.cpp:217
UnitStats getMinStats() const
Gets the minimum stats for the random stats generator.
Definition: RuleSoldier.cpp:163
std::string getArmor() const
Gets the default-equipped armor.
Definition: RuleSoldier.cpp:235
Definition: BaseInfoState.cpp:40
int getFemaleFrequency() const
Gets the female appearance ratio.
Definition: RuleSoldier.cpp:244