OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ArticleDefinition.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 
20 #ifndef OPENXCOM_ARTICLEDEFINITION_H
21 #define OPENXCOM_ARTICLEDEFINITION_H
22 
23 #include <string>
24 #include <vector>
25 #include <yaml-cpp/yaml.h>
26 
27 namespace OpenXcom
28 {
31  UFOPAEDIA_TYPE_UNKNOWN = 0,
32  UFOPAEDIA_TYPE_CRAFT = 1,
33  UFOPAEDIA_TYPE_CRAFT_WEAPON = 2,
34  UFOPAEDIA_TYPE_VEHICLE = 3,
35  UFOPAEDIA_TYPE_ITEM = 4,
36  UFOPAEDIA_TYPE_ARMOR = 5,
37  UFOPAEDIA_TYPE_BASE_FACILITY = 6,
38  UFOPAEDIA_TYPE_TEXTIMAGE = 7,
39  UFOPAEDIA_TYPE_TEXT = 8,
40  UFOPAEDIA_TYPE_UFO = 9
41  };
42 
50  {
51  protected:
54 
55  public:
57  virtual ~ArticleDefinition();
59  UfopaediaTypeId getType() const;
61  virtual void load(const YAML::Node& node, int listOrder);
63  int getListOrder() const;
64 
65  std::string id;
66  std::string title;
67  std::string section;
68  std::vector<std::string> requires;
69 
70  protected:
71  UfopaediaTypeId _type_id;
72  private:
73  int _listOrder;
74  };
75 
77  {
78  public:
80 
81  void set(int set_x, int set_y, int set_width, int set_height);
82 
83  int x;
84  int y;
85  int width;
86  int height;
87  };
88 
95  {
96  public:
100  void load(const YAML::Node& node, int listOrder);
101 
102  std::string image_id;
103  ArticleDefinitionRect rect_stats;
104  ArticleDefinitionRect rect_text;
105  std::string text;
106  };
107 
114  {
115  public:
119  void load(const YAML::Node& node, int listOrder);
120 
121  std::string image_id;
122  std::string text;
123  };
124 
130  {
131  public:
135  void load(const YAML::Node& node, int listOrder);
136 
137  std::string text;
138  };
139 
146  {
147  public:
151  void load(const YAML::Node& node, int listOrder);
152 
153  std::string image_id;
154  std::string text;
155  int text_width;
156  };
157 
164  {
165  public:
169  void load(const YAML::Node& node, int listOrder);
170 
171  std::string text;
172  };
173 
180  {
181  public:
185  void load(const YAML::Node& node, int listOrder);
186 
187  std::string text;
188  };
189 
196  {
197  public:
201  void load(const YAML::Node& node, int listOrder);
202 
203  std::string text;
204  };
205 
212  {
213  public:
217  void load(const YAML::Node& node, int listOrder);
218 
219  std::string text;
220  };
221 
228  {
229  public:
233  void load(const YAML::Node& node, int listOrder);
234 
235  std::string text;
236  std::string weapon;
237  };
238 
239 
240 }
241 
242 #endif
ArticleDefinitionVehicle defines articles for Vehicles, e.g.
Definition: ArticleDefinition.h:227
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:209
ArticleDefinitionCraft()
Constructor.
Definition: ArticleDefinition.cpp:127
ArticleDefinitionCraftWeapon defines articles for craft weapons, e.g.
Definition: ArticleDefinition.h:113
ArticleDefinitionRect()
Constructor.
Definition: ArticleDefinition.cpp:107
ArticleDefinitionArmor()
Constructor.
Definition: ArticleDefinition.cpp:252
UfopaediaTypeId getType() const
Gets the type of article definition.
Definition: ArticleDefinition.cpp:71
ArticleDefinitionItem()
Constructor.
Definition: ArticleDefinition.cpp:218
ArticleDefinitionTextImage defines articles with text on the left and an image on the right side of t...
Definition: ArticleDefinition.h:145
ArticleDefinitionVehicle()
Constructor.
Definition: ArticleDefinition.cpp:269
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:155
virtual void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:81
ArticleDefinitionTextImage()
Constructor.
Definition: ArticleDefinition.cpp:182
ArticleDefinitionText()
Constructor.
Definition: ArticleDefinition.cpp:165
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:243
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:226
ArticleDefinitionUfo()
Constructor.
Definition: ArticleDefinition.cpp:235
int getListOrder() const
Gets the article's list weight.
Definition: ArticleDefinition.cpp:99
ArticleDefinitionItem defines articles for all Items, e.g.
Definition: ArticleDefinition.h:179
ArticleDefinition(UfopaediaTypeId type_id)
Constructor (protected, so this class cannot be instantiated directly).
Definition: ArticleDefinition.cpp:58
void set(int set_x, int set_y, int set_width, int set_height)
Sets the rectangle parameters in a function.
Definition: ArticleDefinition.cpp:116
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:190
UfopaediaTypeId
define article types
Definition: ArticleDefinition.h:30
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:260
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:173
ArticleDefinitionCraft defines articles for craft, e.g.
Definition: ArticleDefinition.h:94
ArticleDefinitionBaseFacility defines articles for base facilities, e.g.
Definition: ArticleDefinition.h:163
ArticleDefinitionArmor defines articles for Armor, e.g.
Definition: ArticleDefinition.h:211
Definition: ArticleDefinition.h:76
ArticleDefinition is the base class for all article types.
Definition: ArticleDefinition.h:49
virtual ~ArticleDefinition()
Destructor.
Definition: ArticleDefinition.cpp:64
ArticleDefinitionBaseFacility()
Constructor.
Definition: ArticleDefinition.cpp:201
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:135
ArticleDefinitionCraftWeapon()
Constructor.
Definition: ArticleDefinition.cpp:147
void load(const YAML::Node &node, int listOrder)
Loads the article from YAML.
Definition: ArticleDefinition.cpp:277
ArticleDefinitionText defines articles with only text, e.g.
Definition: ArticleDefinition.h:129
ArticleDefinitionUfo defines articles for UFOs, e.g.
Definition: ArticleDefinition.h:195