14 #ifndef UNIT_TYPES_H_INCLUDED
15 #define UNIT_TYPES_H_INCLUDED
26 #include <boost/noncopyable.hpp>
84 {
const_cast<unit_type *
>(
this)->
build(status, movement_types, races, traits); }
145 const std::vector<unit_animation>&
animations()
const;
149 std::vector<attack_type>
attacks()
const;
155 (LAWFUL,
N_(
"lawful"))
156 (NEUTRAL,
N_(
"neutral"))
157 (CHAOTIC,
N_(
"chaotic"))
158 (LIMINAL,
N_(
"liminal"))
161 ALIGNMENT alignment()
const {
return alignment_; }
306 :
private boost::noncopyable
336 std::pair<unit_type_map::iterator, bool>
insert(
const std::pair<std::string, unit_type> &utype) {
return types_.insert(utype); }
~unit_experience_accelerator()
child_itors child_range(const std::string &key)
void set_config(config &cfg)
Resets all data based on the provided config.
unit_type::BUILD_STATUS build_status_
std::map< std::string, unit_type > unit_type_map
void read_hide_help(const config &cfg)
Parses the [hide_help] tag.
std::string default_variation_
static int get_acceleration()
error(const std::string &msg)
const std::string log_id() const
A variant on id() that is more descriptive, for use with message logging.
bool has_variation(const std::string &variation_id) const
bool hide_help(const std::string &type_id, const std::string &race_id) const
Checks if the [hide_help] tag contains these IDs.
const unit_type & get_gender_unit_type(std::string gender) const
const t_string & type_name() const
The name of the unit in the current language setting.
const std::vector< t_string > & abilities() const
const std::string & default_variation() const
const std::vector< std::string > advances_from() const
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...
config::const_child_itors modification_advancements() const
std::vector< t_string > adv_abilities_
bool musthave_status(const std::string &status) const
std::string base_id_
A suffix for id_, used when logging messages.
MAKE_ENUM(ALIGNMENT,(LAWFUL, N_("lawful"))(NEUTRAL, N_("neutral"))(CHAOTIC, N_("chaotic"))(LIMINAL, N_("liminal"))) ALIGNMENT alignment() const
bool has_ability_by_id(const std::string &ability) const
const std::vector< t_string > & ability_tooltips() const
const movetype & movement_type() const
double xp_bar_scaling() const
const std::string & variation_name() const
void adjust_profile(std::string &profile)
std::vector< std::string > get_ability_list() const
const std::string & undead_variation() const
Info on the type of unit that the unit reanimates as.
void build_all(unit_type::BUILD_STATUS status)
Makes sure the all unit_types are built to the specified level.
const unit_race * race() const
Never returns nullptr, but may point to the null race.
const std::string & image() const
BUILD_STATUS
Records the status of the lazy building of unit types.
const config & abilities_cfg() const
const std::vector< unit_animation > & animations() const
std::string variation_name_
t_string type_name_
The id of the top ancestor of this unit_type.
bool built_unit_cfg_
Generated as needed via get_cfg_for_units().
variations_map variations_
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.
bool generate_name() const
The basic "size" of the unit - flying, small land, large land, etc.
void operator=(const unit_type &o)
bool has_random_traits() const
std::string ellipse() const
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).
GLsizei GLenum GLenum * types
std::pair< const_child_iterator, const_child_iterator > const_child_itors
void add_advancefrom(const config &unit_cfg) const
const config & build_unit_cfg() const
Generates (and returns) a trimmed config suitable for use with units.
const unit_race * find_race(const std::string &) const
const std::string & flag_rgb() const
movement_type_map movement_types_
const unit_type_map & types() const
std::vector< t_string > adv_ability_tooltips_
const std::string & big_profile() const
std::vector< std::set< std::string > > hide_help_type_
std::vector< std::set< std::string > > hide_help_race_
std::vector< unit_animation > animations_
std::string small_profile_
void add_advancement(unit_type &to_unit) const
bool resistance_filter_matches(const config &cfg, bool attacker, const std::string &damage_name, int res) const
Identical to unit::resistance_filter_matches.
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...
bool show_variations_in_help() const
Whether the unit type has at least one help-visible variation.
std::string undead_variation_
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.
void add_advancement(const unit_type &advance_to, int experience)
Adds an additional advancement path to a unit type.
const std::string & icon() const
std::map< std::string, movetype > movement_type_map
Error used for any general game error, e.g.
Templates and utility-routines for strings and numbers.
const std::string & small_profile() const
void check_types(const std::vector< std::string > &types) const
std::string race_id() const
Returns the ID of this type's race without the need to build the type.
unit_type * gender_types_[2]
std::pair< unit_type_map::iterator, bool > insert(const std::pair< std::string, unit_type > &utype)
config::const_child_itors advancements() const
int vision(bool base_value) const
If base_value is set to true, do not fall back to movement().
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).
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.
const std::string & usage() const
const std::vector< std::string > & advances_to() const
double hp_bar_scaling() const
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).
const unit_type & get_variation(const std::string &id) const
config::const_child_itors possible_traits() const
std::vector< std::string > advances_to_
const race_map & races() const
std::vector< std::string > variations() const
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
bool hide_help_all_
True if [hide_help] contains a 'all=yes' at its root.
const config & get_cfg() const
fixed_t alpha_
Never nullptr, but may point to the null race.
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.
const config::const_child_itors traits() const
unit_experience_accelerator(int modifier)
int experience_needed(bool with_acceleration=true) const
config::const_child_itors events() const
std::vector< t_string > abilities_
const std::string & base_id() const
The id of the original type from which this (variation) descended.
const std::vector< t_string > & adv_abilities() const
BUILD_STATUS build_status_
unit_type(const config &cfg, const std::string &parent_id="")
Creates a unit type for the given config, but delays its build till later.
std::vector< attack_type > attacks() const
static void check_id(std::string &id)
unsigned int num_traits() const
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.
unit_type_data unit_types
game_error(const std::string &msg)
std::vector< t_string > ability_tooltips_
std::map< std::string, unit_race > race_map
std::map< std::string, unit_type * > variations_map
A config object defines a single node in a WML file, with access to child nodes.
static std::string alignment_description(ALIGNMENT align, unit_race::GENDER gender=unit_race::MALE)
Defines the MAKE_ENUM macro.
GLsizei const GLcharARB ** string
int resistance_against(const std::string &damage_name, bool attacker) const
Gets resistance while considering custom WML abilities.
const std::string & id() const
The id for this unit_type.
std::vector< unit_race::GENDER > genders_
t_string unit_description() const
const config & get_cfg_for_units() const
Returns a trimmed config suitable for use with units.
const std::vector< t_string > & adv_ability_tooltips() const