The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
types.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef UNIT_TYPES_H_INCLUDED
15 #define UNIT_TYPES_H_INCLUDED
16 
17 #include "gettext.hpp"
18 #include "utils/make_enum.hpp"
19 #include "map/location.hpp"
20 #include "movetype.hpp"
21 #include "units/race.hpp"
22 #include "units/attack_type.hpp"
23 #include "util.hpp"
24 #include "game_errors.hpp"
25 
26 #include <boost/noncopyable.hpp>
27 #include <map>
28 #include <set>
29 #include <string>
30 #include <vector>
31 
32 class unit_ability_list;
34 
35 
36 typedef std::map<std::string, movetype> movement_type_map;
37 
38 
39 class unit_type
40 {
41 public:
42  class error : public game::game_error
43  {
44  public:
46  : game::game_error(msg)
47  {
48  }
49  };
50  /**
51  * Creates a unit type for the given config, but delays its build
52  * till later.
53  * @note @a cfg is not copied, so it has to point to some permanent
54  * storage, that is, a child of unit_type_data::unit_cfg.
55  */
56  explicit unit_type(const config &cfg, const std::string & parent_id="");
57  unit_type(const unit_type& o);
58 
59  ~unit_type();
60 
61  /// Records the status of the lazy building of unit types.
62  /// These are in order of increasing levels of being built.
63  /// HELP_INDEX is already defined in a windows header under some conditions.
65  static void check_id(std::string& id);
66 private: // These will be called by build().
67  /// Load data into an empty unit_type (build to FULL).
68  void build_full(const movement_type_map &movement_types,
69  const race_map &races, const config::const_child_itors &traits);
70  /// Partially load data into an empty unit_type (build to HELP_INDEXED).
71  void build_help_index(const movement_type_map &movement_types,
72  const race_map &races, const config::const_child_itors &traits);
73  /// Load the most needed data into an empty unit_type (build to CREATE).
74  void build_created(const movement_type_map &movement_types,
75  const race_map &races, const config::const_child_itors &traits);
76 public:
77  /// Performs a build of this to the indicated stage.
78  void build(BUILD_STATUS status, const movement_type_map &movement_types,
79  const race_map &races, const config::const_child_itors &traits);
80  /// Performs a build of this to the indicated stage.
81  /// (This does not logically change the unit type, so allow const access.)
82  void build(BUILD_STATUS status, const movement_type_map &movement_types,
83  const race_map &races, const config::const_child_itors &traits) const
84  { const_cast<unit_type *>(this)->build(status, movement_types, races, traits); }
85 
86 
87  /**
88  * Adds an additional advancement path to a unit type.
89  * This is used to implement the [advancefrom] tag.
90  */
91  void add_advancement(const unit_type &advance_to,int experience);
92 
93  /** Get the advancement tree
94  * Build a set of unit type's id of this unit type's advancement tree */
95  std::set<std::string> advancement_tree() const;
96 
97  const std::vector<std::string>& advances_to() const { return advances_to_; }
98  const std::vector<std::string> advances_from() const;
99 
101  { return cfg_.child_range("advancement"); }
102 
103  const unit_type& get_gender_unit_type(std::string gender) const;
104  const unit_type& get_gender_unit_type(unit_race::GENDER gender) const;
105  const unit_type& get_variation(const std::string& id) const;
106  /** Info on the type of unit that the unit reanimates as. */
107  const std::string& undead_variation() const { return undead_variation_; }
108 
109  unsigned int num_traits() const { return num_traits_; }
110 
111  /** The name of the unit in the current language setting. */
112  const t_string& type_name() const { return type_name_; }
113 
114  /// The id for this unit_type.
115  const std::string& id() const { return id_; }
116  /// A variant on id() that is more descriptive, for use with message logging.
117  const std::string log_id() const { return id_ + debug_id_; }
118  /// The id of the original type from which this (variation) descended.
119  const std::string& base_id() const { return base_id_; }
120  // NOTE: this used to be a const object reference, but it messed up with the
121  // translation engine upon changing the language in the same session.
122  t_string unit_description() const;
123  int hitpoints() const { return hitpoints_; }
124  double hp_bar_scaling() const { return hp_bar_scaling_; }
125  double xp_bar_scaling() const { return xp_bar_scaling_; }
126  int level() const { return level_; }
127  int recall_cost() const { return recall_cost_;}
128  int movement() const { return movement_; }
129  int vision() const { return vision_ < 0 ? movement() : vision_; }
130  /// If @a base_value is set to true, do not fall back to movement().
131  int vision(bool base_value) const { return base_value ? vision_ : vision(); }
132  int jamming() const {return jamming_; }
133  int max_attacks() const { return max_attacks_; }
134  int cost() const { return cost_; }
136  const std::string& variation_name() const { return variation_name_; }
137  const std::string& usage() const { return usage_; }
138  const std::string& image() const { return image_; }
139  const std::string& icon() const { return icon_; }
140  const std::string &small_profile() const { return small_profile_; }
141  const std::string &big_profile() const { return profile_; }
142  std::string halo() const { return cfg_["halo"]; }
143  std::string ellipse() const { return cfg_["ellipse"]; }
144  bool generate_name() const { return cfg_["generate_name"].to_bool(true); }
145  const std::vector<unit_animation>& animations() const;
146 
147  const std::string& flag_rgb() const { return flag_rgb_; }
148 
149  std::vector<attack_type> attacks() const;
150  const movetype & movement_type() const { return movement_type_; }
151 
152  int experience_needed(bool with_acceleration=true) const;
153 
154  MAKE_ENUM (ALIGNMENT,
155  (LAWFUL, N_("lawful"))
156  (NEUTRAL, N_("neutral"))
157  (CHAOTIC, N_("chaotic"))
158  (LIMINAL, N_("liminal"))
159  )
160 
161  ALIGNMENT alignment() const { return alignment_; }
162  static std::string alignment_description(ALIGNMENT align, unit_race::GENDER gender = unit_race::MALE);
163 
164  fixed_t alpha() const { return alpha_; }
165 
166  const std::vector<t_string>& abilities() const { return abilities_; }
167  const std::vector<t_string>& ability_tooltips() const { return ability_tooltips_; }
168 
169  // some extra abilities may be gained through AMLA advancements
170  const std::vector<t_string>& adv_abilities() const { return adv_abilities_; }
171  const std::vector<t_string>& adv_ability_tooltips() const { return adv_ability_tooltips_; }
172 
173  bool can_advance() const { return !advances_to_.empty(); }
174 
175  bool musthave_status(const std::string& status) const;
176 
177  bool has_zoc() const { return zoc_; }
178 
179  bool has_ability_by_id(const std::string& ability) const;
180  std::vector<std::string> get_ability_list() const;
181 
183  { return possible_traits_.child_range("trait"); }
184 
185  const config& abilities_cfg() const
186  { return cfg_.child_or_empty("abilities"); }
187 
189  { return cfg_.child_range("advancement"); }
190 
192  { return cfg_.child_range("event"); }
193 
194  bool has_random_traits() const;
195 
196  /// The returned vector will not be empty, provided this has been built
197  /// to the HELP_INDEXED status.
198  const std::vector<unit_race::GENDER>& genders() const { return genders_; }
199  std::vector<std::string> variations() const;
200 
201  /**
202  * @param variation_id The id of the variation we search for.
203  * @return Whether one of the type's variations' (or the
204  * siblings' if the unit_type is a variation
205  * itself) id matches @a variation_id.
206  */
207  bool has_variation(const std::string& variation_id) const;
208 
209  /**
210  * Whether the unit type has at least one help-visible variation.
211  */
212  bool show_variations_in_help() const;
213 
214  /// Returns the ID of this type's race without the need to build the type.
215  std::string race_id() const { return cfg_["race"]; } //race_->id(); }
216  /// Never returns nullptr, but may point to the null race.
217  /// Requires building to the HELP_INDEXED status to get the correct race.
218  const unit_race* race() const { return race_; }
219  bool hide_help() const;
220  bool do_not_list() const { return do_not_list_; }
221 
222  const config &get_cfg() const { return cfg_; }
223  /// Returns a trimmed config suitable for use with units.
224  const config & get_cfg_for_units() const
225  { return built_unit_cfg_ ? unit_cfg_ : build_unit_cfg(); }
226 
227  /// Gets resistance while considering custom WML abilities.
228  /// Attention: Filters in resistance-abilities will be ignored.
229  int resistance_against(const std::string& damage_name, bool attacker) const;
230 
231 private:
232  /// Generates (and returns) a trimmed config suitable for use with units.
233  const config & build_unit_cfg() const;
234 
235  /// Identical to unit::resistance_filter_matches.
236  bool resistance_filter_matches(const config& cfg,bool attacker,const std::string& damage_name, int res) const;
237 
238 private:
239  void operator=(const unit_type& o);
240 
241  const config &cfg_;
242  mutable config unit_cfg_; /// Generated as needed via get_cfg_for_units().
243  mutable bool built_unit_cfg_;
244 
246  std::string debug_id_; /// A suffix for id_, used when logging messages.
247  std::string base_id_; /// The id of the top ancestor of this unit_type.
252  int level_;
255  int vision_;
256  int jamming_;
258  int cost_;
261 
267 
268  unsigned int num_traits_;
269 
271 
272  typedef std::map<std::string,unit_type*> variations_map;
273  variations_map variations_;
276 
277  const unit_race* race_; /// Never nullptr, but may point to the null race.
278 
280 
281  std::vector<t_string> abilities_, adv_abilities_;
282  std::vector<t_string> ability_tooltips_, adv_ability_tooltips_;
283 
285 
286  std::vector<std::string> advances_to_;
289 
290 
291  ALIGNMENT alignment_;
292 
294 
296 
297  std::vector<unit_race::GENDER> genders_;
298 
299  // animations are loaded only after the first animations() call
300  mutable std::vector<unit_animation> animations_;
301 
303 };
304 
306  : private boost::noncopyable
307 {
308 public:
309  unit_type_data();
310 
311  typedef std::map<std::string,unit_type> unit_type_map;
312 
313  const unit_type_map &types() const { return types_; }
314  const race_map &races() const { return races_; }
315  const config::const_child_itors traits() const { return unit_cfg_->child_range("trait"); }
316  void set_config(config &cfg);
317 
318  /// Finds a unit_type by its id() and makes sure it is built to the specified level.
319  const unit_type *find(const std::string &key, unit_type::BUILD_STATUS status = unit_type::FULL) const;
320  void check_types(const std::vector<std::string>& types) const;
321  const unit_race *find_race(const std::string &) const;
322 
323  /// Makes sure the all unit_types are built to the specified level.
324  void build_all(unit_type::BUILD_STATUS status);
325  /// Makes sure the provided unit_type is built to the specified level.
326  void build_unit_type(const unit_type & ut, unit_type::BUILD_STATUS status) const
327  { ut.build(status, movement_types_, races_, unit_cfg_->child_range("trait")); }
328 
329  /** Checks if the [hide_help] tag contains these IDs. */
330  bool hide_help(const std::string &type_id, const std::string &race_id) const;
331 
332 private:
333  /** Parses the [hide_help] tag. */
334  void read_hide_help(const config &cfg);
335 
336  std::pair<unit_type_map::iterator, bool> insert(const std::pair<std::string, unit_type> &utype) { return types_.insert(utype); }
337  void clear();
338 
339  void add_advancefrom(const config& unit_cfg) const;
340  void add_advancement(unit_type& to_unit) const;
341 
342  mutable unit_type_map types_;
345 
346  /** True if [hide_help] contains a 'all=yes' at its root. */
348  // vectors containing the [hide_help] and its sub-tags [not]
349  std::vector< std::set<std::string> > hide_help_type_;
350  std::vector< std::set<std::string> > hide_help_race_;
351 
354 };
355 
357 
358 void adjust_profile(std::string& profile);
359 
361  unit_experience_accelerator(int modifier);
363  static int get_acceleration();
364 private:
366 };
367 
368 #endif
int jamming_
Definition: types.hpp:256
child_itors child_range(const std::string &key)
Definition: config.cpp:613
void set_config(config &cfg)
Resets all data based on the provided config.
Definition: types.cpp:1005
int experience_needed_
Definition: types.hpp:287
bool do_not_list_
Definition: types.hpp:284
unit_type::BUILD_STATUS build_status_
Definition: types.hpp:353
std::map< std::string, unit_type > unit_type_map
Definition: types.hpp:311
void read_hide_help(const config &cfg)
Parses the [hide_help] tag.
Definition: types.cpp:1218
std::string default_variation_
Definition: types.hpp:274
static int get_acceleration()
Definition: types.cpp:509
error(const std::string &msg)
Definition: types.hpp:45
const std::string log_id() const
A variant on id() that is more descriptive, for use with message logging.
Definition: types.hpp:117
bool do_not_list() const
Definition: types.hpp:220
std::string flag_rgb_
Definition: types.hpp:266
bool has_variation(const std::string &variation_id) const
Definition: types.cpp:736
bool hide_help(const std::string &type_id, const std::string &race_id) const
Checks if the [hide_help] tag contains these IDs.
Definition: types.cpp:1246
const unit_type & get_gender_unit_type(std::string gender) const
Definition: types.cpp:439
const t_string & type_name() const
The name of the unit in the current language setting.
Definition: types.hpp:112
const std::vector< t_string > & abilities() const
Definition: types.hpp:166
int movement() const
Definition: types.hpp:128
const std::string & default_variation() const
Definition: types.hpp:135
const std::vector< std::string > advances_from() const
Definition: types.cpp:649
ALIGNMENT alignment_
Definition: types.hpp:291
std::set< std::string > advancement_tree() const
Get the advancement tree Build a set of unit type's id of this unit type's advancement tree...
Definition: types.cpp:642
std::string profile_
Definition: types.hpp:265
config::const_child_itors modification_advancements() const
Definition: types.hpp:100
std::vector< t_string > adv_abilities_
Definition: types.hpp:281
int max_attacks() const
Definition: types.hpp:133
bool musthave_status(const std::string &status) const
Definition: types.cpp:669
std::string debug_id_
Definition: types.hpp:246
int hitpoints_
Definition: types.hpp:250
int recall_cost_
Definition: types.hpp:253
std::string base_id_
A suffix for id_, used when logging messages.
Definition: types.hpp:247
Sint32 fixed_t
Definition: drawer.hpp:40
MAKE_ENUM(ALIGNMENT,(LAWFUL, N_("lawful"))(NEUTRAL, N_("neutral"))(CHAOTIC, N_("chaotic"))(LIMINAL, N_("liminal"))) ALIGNMENT alignment() const
Definition: types.hpp:154
bool has_ability_by_id(const std::string &ability) const
Definition: types.cpp:533
const std::vector< t_string > & ability_tooltips() const
Definition: types.hpp:167
const movetype & movement_type() const
Definition: types.hpp:150
~unit_type()
Definition: types.cpp:166
double xp_bar_scaling() const
Definition: types.hpp:125
const std::string & variation_name() const
Definition: types.hpp:136
void adjust_profile(std::string &profile)
Definition: types.cpp:1317
fixed_t alpha() const
Definition: types.hpp:164
std::vector< std::string > get_ability_list() const
Definition: types.cpp:545
const std::string & undead_variation() const
Info on the type of unit that the unit reanimates as.
Definition: types.hpp:107
t_string description_
Definition: types.hpp:249
int jamming() const
Definition: types.hpp:132
void build_all(unit_type::BUILD_STATUS status)
Makes sure the all unit_types are built to the specified level.
Definition: types.cpp:1196
config possible_traits_
Definition: types.hpp:295
const unit_race * race() const
Never returns nullptr, but may point to the null race.
Definition: types.hpp:218
const std::string & image() const
Definition: types.hpp:138
BUILD_STATUS
Records the status of the lazy building of unit types.
Definition: types.hpp:64
const config & abilities_cfg() const
Definition: types.hpp:185
const std::vector< unit_animation > & animations() const
Definition: types.cpp:476
std::string variation_name_
Definition: types.hpp:275
t_string type_name_
The id of the top ancestor of this unit_type.
Definition: types.hpp:248
bool built_unit_cfg_
Generated as needed via get_cfg_for_units().
Definition: types.hpp:243
variations_map variations_
Definition: types.hpp:273
const config & child_or_empty(const std::string &key) const
Returns the first child with the given key, or an empty config if there is none.
Definition: config.cpp:722
bool generate_name() const
Definition: types.hpp:144
const config & cfg_
Definition: types.hpp:241
The basic "size" of the unit - flying, small land, large land, etc.
Definition: movetype.hpp:28
int level() const
Definition: types.hpp:126
void operator=(const unit_type &o)
bool has_random_traits() const
Definition: types.cpp:713
std::string ellipse() const
Definition: types.hpp:143
void build_help_index(const movement_type_map &movement_types, const race_map &races, const config::const_child_itors &traits)
Partially load data into an empty unit_type (build to HELP_INDEXED).
Definition: types.cpp:243
GLsizei GLenum GLenum * types
Definition: glew.h:3155
std::pair< const_child_iterator, const_child_iterator > const_child_itors
Definition: config.hpp:214
int level_
Definition: types.hpp:252
const unit_race * race_
Definition: types.hpp:277
bool can_advance() const
Definition: types.hpp:173
void add_advancefrom(const config &unit_cfg) const
bool in_advancefrom_
Definition: types.hpp:288
std::string icon_
Definition: types.hpp:263
const config & build_unit_cfg() const
Generates (and returns) a trimmed config suitable for use with units.
Definition: types.cpp:756
const unit_race * find_race(const std::string &) const
Definition: types.cpp:1286
const std::string & flag_rgb() const
Definition: types.hpp:147
movement_type_map movement_types_
Definition: types.hpp:343
bool zoc_
Definition: types.hpp:284
const unit_type_map & types() const
Definition: types.hpp:313
std::vector< t_string > adv_ability_tooltips_
Definition: types.hpp:282
const std::string & big_profile() const
Definition: types.hpp:141
std::vector< std::set< std::string > > hide_help_type_
Definition: types.hpp:349
std::vector< std::set< std::string > > hide_help_race_
Definition: types.hpp:350
std::vector< unit_animation > animations_
Definition: types.hpp:300
std::string small_profile_
Definition: types.hpp:264
void add_advancement(unit_type &to_unit) const
Definition: types.cpp:1261
bool resistance_filter_matches(const config &cfg, bool attacker, const std::string &damage_name, int res) const
Identical to unit::resistance_filter_matches.
Definition: types.cpp:800
const std::vector< unit_race::GENDER > & genders() const
The returned vector will not be empty, provided this has been built to the HELP_INDEXED status...
Definition: types.hpp:198
bool show_variations_in_help() const
Whether the unit type has at least one help-visible variation.
Definition: types.cpp:741
std::string undead_variation_
Definition: types.hpp:260
void build_unit_type(const unit_type &ut, unit_type::BUILD_STATUS status) const
Makes sure the provided unit_type is built to the specified level.
Definition: types.hpp:326
void add_advancement(const unit_type &advance_to, int experience)
Adds an additional advancement path to a unit type.
Definition: types.cpp:565
int movement_
Definition: types.hpp:254
movetype movement_type_
Definition: types.hpp:293
const std::string & icon() const
Definition: types.hpp:139
std::map< std::string, movetype > movement_type_map
Definition: types.hpp:33
Error used for any general game error, e.g.
Definition: game_errors.hpp:46
Templates and utility-routines for strings and numbers.
const std::string & small_profile() const
Definition: types.hpp:140
void check_types(const std::vector< std::string > &types) const
Definition: types.cpp:1177
double xp_bar_scaling_
Definition: types.hpp:251
std::string race_id() const
Returns the ID of this type's race without the need to build the type.
Definition: types.hpp:215
unit_type * gender_types_[2]
Definition: types.hpp:270
int cost() const
Definition: types.hpp:134
std::pair< unit_type_map::iterator, bool > insert(const std::pair< std::string, unit_type > &utype)
Definition: types.hpp:336
config::const_child_itors advancements() const
Definition: types.hpp:188
int vision(bool base_value) const
If base_value is set to true, do not fall back to movement().
Definition: types.hpp:131
int cost_
Definition: types.hpp:258
void build_created(const movement_type_map &movement_types, const race_map &races, const config::const_child_itors &traits)
Load the most needed data into an empty unit_type (build to CREATE).
Definition: types.cpp:365
void build(BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config::const_child_itors &traits)
Performs a build of this to the indicated stage.
Definition: types.cpp:405
const std::string & usage() const
Definition: types.hpp:137
const std::vector< std::string > & advances_to() const
Definition: types.hpp:97
GLuint res
Definition: glew.h:9258
double hp_bar_scaling() const
Definition: types.hpp:124
unsigned int num_traits_
Definition: types.hpp:268
bool has_zoc() const
Definition: types.hpp:177
void build_full(const movement_type_map &movement_types, const race_map &races, const config::const_child_itors &traits)
Load data into an empty unit_type (build to FULL).
Definition: types.cpp:179
unit_type_map types_
Definition: types.hpp:342
const config * unit_cfg_
Definition: types.hpp:352
std::string halo() const
Definition: types.hpp:142
const unit_type & get_variation(const std::string &id) const
Definition: types.cpp:457
config::const_child_itors possible_traits() const
Definition: types.hpp:182
std::vector< std::string > advances_to_
Definition: types.hpp:286
int vision() const
Definition: types.hpp:129
std::string usage_
Definition: types.hpp:259
const race_map & races() const
Definition: types.hpp:314
std::vector< std::string > variations() const
Definition: types.cpp:726
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
double hp_bar_scaling_
Definition: types.hpp:251
bool hide_help_all_
True if [hide_help] contains a 'all=yes' at its root.
Definition: types.hpp:347
#define N_(String)
Definition: gettext.hpp:90
bool hide_help() const
Definition: types.cpp:561
const config & get_cfg() const
Definition: types.hpp:222
fixed_t alpha_
Never nullptr, but may point to the null race.
Definition: types.hpp:279
void build(BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config::const_child_itors &traits) const
Performs a build of this to the indicated stage.
Definition: types.hpp:82
std::string id_
Definition: types.hpp:245
const config::const_child_itors traits() const
Definition: types.hpp:315
unit_experience_accelerator(int modifier)
Definition: types.cpp:499
int hitpoints() const
Definition: types.hpp:123
int experience_needed(bool with_acceleration=true) const
Definition: types.cpp:514
config::const_child_itors events() const
Definition: types.hpp:191
std::vector< t_string > abilities_
Definition: types.hpp:281
const std::string & base_id() const
The id of the original type from which this (variation) descended.
Definition: types.hpp:119
int vision_
Definition: types.hpp:255
const std::vector< t_string > & adv_abilities() const
Definition: types.hpp:170
BUILD_STATUS build_status_
Definition: types.hpp:302
void clear()
Definition: types.cpp:1184
int max_attacks_
Definition: types.hpp:257
unit_type(const config &cfg, const std::string &parent_id="")
Creates a unit type for the given config, but delays its build till later.
Definition: types.cpp:110
bool hide_help_
Definition: types.hpp:284
std::vector< attack_type > attacks() const
Definition: types.cpp:484
static void check_id(std::string &id)
Definition: types.cpp:1292
unsigned int num_traits() const
Definition: types.hpp:109
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
Definition: types.cpp:1155
config unit_cfg_
Definition: types.hpp:242
unit_type_data unit_types
Definition: types.cpp:1314
game_error(const std::string &msg)
Definition: game_errors.hpp:47
int recall_cost() const
Definition: types.hpp:127
std::vector< t_string > ability_tooltips_
Definition: types.hpp:282
std::map< std::string, unit_race > race_map
Definition: race.hpp:73
std::map< std::string, unit_type * > variations_map
Definition: types.hpp:272
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
static std::string alignment_description(ALIGNMENT align, unit_race::GENDER gender=unit_race::MALE)
Defines the MAKE_ENUM macro.
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::string image_
Definition: types.hpp:262
race_map races_
Definition: types.hpp:344
int resistance_against(const std::string &damage_name, bool attacker) const
Gets resistance while considering custom WML abilities.
Definition: types.cpp:777
const std::string & id() const
The id for this unit_type.
Definition: types.hpp:115
std::vector< unit_race::GENDER > genders_
Definition: types.hpp:297
t_string unit_description() const
Definition: types.cpp:467
const config & get_cfg_for_units() const
Returns a trimmed config suitable for use with units.
Definition: types.hpp:224
const std::vector< t_string > & adv_ability_tooltips() const
Definition: types.hpp:171