OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AlienDeployment.h
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_ALIENDEPLOYMENT_H
20 #define OPENXCOM_ALIENDEPLOYMENT_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 struct ItemSet
33 {
34  std::vector<std::string> items;
35 };
36 
38 {
39  int alienRank;
40  int lowQty, highQty, dQty;
41  int percentageOutsideUfo;
42  std::vector<ItemSet> itemSets;
43 };
44 
56 {
57 private:
58  std::string _type;
59  std::vector<DeploymentData> _data;
60  int _width, _length, _height, _civilians;
61  std::vector<std::string> _terrains;
62  int _shade;
63  std::string _nextStage;
64 public:
66  AlienDeployment(const std::string &type);
70  void load(const YAML::Node& node);
72  std::string getType() const;
74  std::vector<DeploymentData>* getDeploymentData();
76  void getDimensions(int *width, int *length, int *height);
78  int getCivilians() const;
80  std::vector<std::string> getTerrains() const;
82  int getShade() const;
84  std::string getNextStage() const;
85 
86 };
87 
88 }
89 
90 namespace YAML
91 {
92  template<>
93  struct convert<OpenXcom::ItemSet>
94  {
95  static Node encode(const OpenXcom::ItemSet& rhs)
96  {
97  Node node;
98  node = rhs.items;
99  return node;
100  }
101 
102  static bool decode(const Node& node, OpenXcom::ItemSet& rhs)
103  {
104  if (!node.IsSequence())
105  return false;
106 
107  rhs.items = node.as< std::vector<std::string> >(rhs.items);
108  return true;
109  }
110  };
111 }
112 
113 #endif
std::vector< std::string > getTerrains() const
Gets the terrain for battlescape generation.
Definition: AlienDeployment.cpp:136
~AlienDeployment()
Cleans up the Alien Deployment ruleset.
Definition: AlienDeployment.cpp:70
std::string getType() const
Gets the Alien Deployment's type.
Definition: AlienDeployment.cpp:96
std::vector< DeploymentData > * getDeploymentData()
Gets a pointer to the data.
Definition: AlienDeployment.cpp:105
void load(const YAML::Node &node)
Loads Alien Deployment data from YAML.
Definition: AlienDeployment.cpp:78
Definition: AlienDeployment.h:32
int getCivilians() const
Gets civilians.
Definition: AlienDeployment.cpp:127
void getDimensions(int *width, int *length, int *height)
Gets dimensions.
Definition: AlienDeployment.cpp:116
AlienDeployment(const std::string &type)
Creates a blank Alien Deployment ruleset.
Definition: AlienDeployment.cpp:63
int getShade() const
Gets the shade level for battlescape generation.
Definition: AlienDeployment.cpp:145
Definition: AlienDeployment.h:37
Represents a specific type of Alien Deployment.
Definition: AlienDeployment.h:55
std::string getNextStage() const
Gets the next stage of the mission.
Definition: AlienDeployment.cpp:154