The Battle for Wesnoth  1.19.0-dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
unit_type Class Reference

A single unit type that the player may recruit. More...

#include <types.hpp>

Classes

struct  ability_metadata
 
struct  defaut_ctor_t
 

Public Types

enum  BUILD_STATUS {
  NOT_BUILT , CREATED , VARIATIONS , HELP_INDEXED ,
  FULL
}
 Records the status of the lazy building of unit types. More...
 
using error = unit_type_error
 

Public Member Functions

 unit_type (const config &cfg, const std::string &parent_id="")
 Creates a unit type for the given config, but delays its build till later. More...
 
 unit_type (config &&cfg, const std::string &parent_id="")
 Creates a unit type for the given config, but delays its build till later. More...
 
 unit_type ()
 
 unit_type (const unit_type &o)
 
 unit_type (unit_type &&o)=default
 
 ~unit_type ()
 
void build (BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
 Performs a build of this to the indicated stage. More...
 
void build (BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config_array_view &traits) const
 Performs a build of this to the indicated stage. More...
 
std::set< std::string > advancement_tree () const
 Get the advancement tree. More...
 
const std::vector< std::string > & advances_to () const
 A vector of unit_type ids that this unit_type can advance to. More...
 
const std::vector< std::string > advances_from () const
 A vector of unit_type ids that can advance to this unit_type. More...
 
config::const_child_itors modification_advancements () const
 Returns two iterators pointing to a range of AMLA configs. More...
 
const unit_typeget_gender_unit_type (std::string gender) const
 Returns a gendered variant of this unit_type. More...
 
const unit_typeget_gender_unit_type (unit_race::GENDER gender) const
 Returns a gendered variant of this unit_type based on the given parameter. More...
 
const unit_typeget_variation (const std::string &id) const
 
const std::string & undead_variation () const
 Info on the type of unit that the unit reanimates as. More...
 
unsigned int num_traits () const
 
const t_stringtype_name () const
 The name of the unit in the current language setting. More...
 
const std::string & id () const
 The id for this unit_type. More...
 
const std::string log_id () const
 A variant on id() that is more descriptive, for use with message logging. More...
 
const std::string & parent_id () const
 The id of the original type from which this (variation) descended. More...
 
const std::string & variation_id () const
 The id of this variation; empty if it's a gender variation or a base unit. More...
 
t_string unit_description () const
 
std::vector< t_stringdirect_special_notes () const
 Returns only the notes defined by [unit_type][special_note] tags, excluding any that would be found from abilities, attacks, etc. More...
 
std::vector< t_stringspecial_notes () const
 Returns all notes that should be displayed in the help page for this type, including those found in abilities and attacks. More...
 
int hitpoints () const
 
double hp_bar_scaling () const
 
double xp_bar_scaling () const
 
int level () const
 
int recall_cost () const
 
int movement () const
 
int vision () const
 
int vision (bool base_value) const
 If base_value is set to true, do not fall back to movement(). More...
 
int jamming () const
 
int max_attacks () const
 
int cost () const
 
const std::string & default_variation () const
 
const t_stringvariation_name () const
 
const std::string & usage () const
 
const std::string & image () const
 
const std::string & icon () const
 
const std::string & small_profile () const
 
const std::string & big_profile () const
 
std::string halo () const
 
std::string ellipse () const
 
bool generate_name () const
 
const std::vector< unit_animation > & animations () const
 
const std::string & flag_rgb () const
 
const_attack_itors attacks () const
 
const movetypemovement_type () const
 
int experience_needed (bool with_acceleration=true) const
 
unit_alignments::type alignment () const
 
const std::vector< ability_metadata > & abilities_metadata () const
 
const std::vector< ability_metadata > & adv_abilities_metadata () const
 Some extra abilities that may be gained through AMLA advancements. More...
 
bool can_advance () const
 
bool musthave_status (const std::string &status) const
 
bool has_zoc () const
 
bool has_ability_by_id (const std::string &ability) const
 
std::vector< std::string > get_ability_list () const
 
config::const_child_itors possible_traits () const
 
const configabilities_cfg () const
 
config::const_child_itors advancements () const
 
config::const_child_itors events () const
 
bool has_random_traits () const
 
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. More...
 
bool has_gender_variation (const unit_race::GENDER gender) const
 
std::vector< std::string > variations () const
 
const variations_mapvariation_types () const
 
bool has_variation (const std::string &variation_id) const
 
bool show_variations_in_help () const
 Whether the unit type has at least one help-visible variation. More...
 
std::string race_id () const
 Returns the ID of this type's race without the need to build the type. More...
 
const unit_racerace () const
 Never returns nullptr, but may point to the null race. More...
 
bool hide_help () const
 
bool do_not_list () const
 
const configget_cfg () const
 
int resistance_against (const std::string &damage_name, bool attacker) const
 Gets resistance while considering custom WML abilities. More...
 
void apply_scenario_fix (const config &cfg)
 
void remove_scenario_fixes ()
 

Static Public Member Functions

static void check_id (std::string &id)
 Validate the id argument. More...
 
static std::string alignment_description (unit_alignments::type align, unit_race::GENDER gender=unit_race::MALE)
 Implementation detail of unit_type::alignment_description. More...
 

Private Types

typedef std::map< std::string, unit_typevariations_map
 

Private Member Functions

 unit_type (defaut_ctor_t, const config &cfg, const std::string &parent_id)
 
void build_full (const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
 Load data into an empty unit_type (build to FULL). More...
 
void build_help_index (const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
 Partially load data into an empty unit_type (build to HELP_INDEXED). More...
 
void build_created ()
 Load the most needed data into an empty unit_type (build to CREATE). More...
 
bool resistance_filter_matches (const config &cfg, bool attacker, const std::string &damage_name, int res) const
 Identical to unit::resistance_filter_matches. More...
 
configwritable_cfg ()
 
void fill_variations ()
 Processes [variation] tags of ut_cfg, handling inheritance and child clearing. More...
 
void fill_variations_and_gender ()
 
std::unique_ptr< unit_typecreate_sub_type (const config &var_cfg, bool default_inherit)
 Handles inheritance for configs of [male], [female], and [variation]. More...
 
unit_typeoperator= (const unit_type &o)=delete
 

Private Attributes

const configcfg_
 
std::unique_ptr< configbuilt_cfg_
 
bool has_cfg_build_
 
attack_list attacks_cache_
 
std::string id_
 
std::string debug_id_
 A suffix for id_, used when logging messages. More...
 
std::string parent_id_
 The id of the top ancestor of this unit_type. More...
 
std::string base_unit_id_
 from [base_unit] More...
 
t_string type_name_
 
t_string description_
 
std::vector< t_stringspecial_notes_
 
int hitpoints_
 
double hp_bar_scaling_
 
double xp_bar_scaling_
 
int level_
 
int recall_cost_
 
int movement_
 
int vision_
 
int jamming_
 
int max_attacks_
 
int cost_
 
std::string usage_
 
std::string undead_variation_
 
std::string image_
 
std::string icon_
 
std::string small_profile_
 
std::string profile_
 
std::string flag_rgb_
 
unsigned int num_traits_
 
std::array< std::unique_ptr< unit_type >, 2 > gender_types_
 
variations_map variations_
 
std::string default_variation_
 
std::string variation_id_
 
t_string variation_name_
 
const unit_racerace_
 Never nullptr, but may point to the null race. More...
 
std::vector< ability_metadataabilities_
 
std::vector< ability_metadataadv_abilities_
 
bool zoc_
 
bool hide_help_
 
bool do_not_list_
 
std::vector< std::string > advances_to_
 
int experience_needed_
 
unit_alignments::type alignment_
 
movetype movement_type_
 
config possible_traits_
 
std::vector< unit_race::GENDERgenders_
 
std::vector< unit_animationanimations_
 
BUILD_STATUS build_status_
 

Friends

class unit_type_data
 

Detailed Description

A single unit type that the player may recruit.

Individual units are defined by the unit class.

Definition at line 42 of file types.hpp.

Member Typedef Documentation

◆ error

Definition at line 49 of file types.hpp.

◆ variations_map

typedef std::map<std::string,unit_type> unit_type::variations_map
private

Definition at line 94 of file types.hpp.

Member Enumeration Documentation

◆ BUILD_STATUS

Records the status of the lazy building of unit types.

These are in order of increasing levels of being built. HELP_INDEX is already defined in a windows header under some conditions

Enumerator
NOT_BUILT 
CREATED 
VARIATIONS 
HELP_INDEXED 
FULL 

Definition at line 74 of file types.hpp.

Constructor & Destructor Documentation

◆ unit_type() [1/6]

unit_type::unit_type ( defaut_ctor_t  ,
const config cfg,
const std::string &  parent_id 
)
private

Definition at line 101 of file types.cpp.

References base_unit_id_, check_id(), id_, LOG_UT, config::optional_child(), and parent_id_.

◆ unit_type() [2/6]

unit_type::unit_type ( const config cfg,
const std::string &  parent_id = "" 
)
explicit

Creates a unit type for the given config, but delays its build till later.

Note
cfg is not copied, so it has to point to some permanent storage, that is, a child of unit_type_data::unit_cfg.

Definition at line 155 of file types.cpp.

References cfg_.

◆ unit_type() [3/6]

unit_type::unit_type ( config &&  cfg,
const std::string &  parent_id = "" 
)
explicit

Creates a unit type for the given config, but delays its build till later.

Note
cfg is copied

Definition at line 162 of file types.cpp.

References built_cfg_.

◆ unit_type() [4/6]

unit_type::unit_type ( )

Referenced by unit_type().

◆ unit_type() [5/6]

unit_type::unit_type ( const unit_type o)

Definition at line 53 of file types.cpp.

References gender_types_, and unit_type().

◆ unit_type() [6/6]

unit_type::unit_type ( unit_type &&  o)
default

◆ ~unit_type()

unit_type::~unit_type ( )

Definition at line 169 of file types.cpp.

Member Function Documentation

◆ abilities_cfg()

const config& unit_type::abilities_cfg ( ) const
inline

Definition at line 233 of file types.hpp.

References config::child_or_empty(), and get_cfg().

Referenced by unit::advance_to(), and special_notes().

◆ abilities_metadata()

const std::vector<ability_metadata>& unit_type::abilities_metadata ( ) const
inline

Definition at line 216 of file types.hpp.

References abilities_.

Referenced by help::unit_topic_generator::operator()().

◆ adv_abilities_metadata()

const std::vector<ability_metadata>& unit_type::adv_abilities_metadata ( ) const
inline

Some extra abilities that may be gained through AMLA advancements.

Definition at line 219 of file types.hpp.

References adv_abilities_.

Referenced by help::unit_topic_generator::operator()().

◆ advancement_tree()

std::set< std::string > unit_type::advancement_tree ( ) const

Get the advancement tree.

Returns
A set of ids of all unit_type objects that this unit_type can directly or indirectly advance to.

Definition at line 644 of file types.cpp.

References advancement_tree_internal(), and id_.

Referenced by ai::default_recruitment::recruitment::do_similarity_penalty().

◆ advancements()

config::const_child_itors unit_type::advancements ( ) const
inline

Definition at line 236 of file types.hpp.

References config::child_range(), and get_cfg().

Referenced by unit::advance_to().

◆ advances_from()

const std::vector< std::string > unit_type::advances_from ( ) const

A vector of unit_type ids that can advance to this unit_type.

Definition at line 651 of file types.cpp.

References unit_type_data::build_all(), HELP_INDEXED, id_, unit_type_data::types(), and unit_types.

Referenced by impl_unit_type_get(), and help::unit_topic_generator::operator()().

◆ advances_to()

const std::vector<std::string>& unit_type::advances_to ( ) const
inline

A vector of unit_type ids that this unit_type can advance to.

Definition at line 115 of file types.hpp.

References advances_to_.

Referenced by unit::advance_to(), advancement_tree_internal(), impl_unit_type_get(), and help::unit_topic_generator::operator()().

◆ alignment()

unit_alignments::type unit_type::alignment ( ) const
inline

◆ alignment_description()

std::string unit_type::alignment_description ( unit_alignments::type  align,
unit_race::GENDER  gender = unit_race::MALE 
)
static

◆ animations()

const std::vector< unit_animation > & unit_type::animations ( ) const

◆ apply_scenario_fix()

void unit_type::apply_scenario_fix ( const config cfg)

◆ attacks()

const_attack_itors unit_type::attacks ( ) const

◆ big_profile()

const std::string& unit_type::big_profile ( ) const
inline

Definition at line 179 of file types.hpp.

References profile_.

Referenced by unit::advance_to(), impl_unit_type_get(), and help::unit_topic_generator::operator()().

◆ build() [1/2]

void unit_type::build ( BUILD_STATUS  status,
const movement_type_map movement_types,
const race_map races,
const config_array_view traits 
)

Performs a build of this to the indicated stage.

Definition at line 417 of file types.cpp.

References build_created(), build_full(), build_help_index(), CREATED, DBG_UT, ERR_UT, FULL, HELP_INDEXED, log_id(), NOT_BUILT, and VARIATIONS.

Referenced by build(), and unit_type_data::build_unit_type().

◆ build() [2/2]

void unit_type::build ( BUILD_STATUS  status,
const movement_type_map movement_types,
const race_map races,
const config_array_view traits 
) const
inline

Performs a build of this to the indicated stage.

(This does not logically change the unit type, so allow const access.)

Definition at line 103 of file types.hpp.

References build().

◆ build_created()

void unit_type::build_created ( )
private

Load the most needed data into an empty unit_type (build to CREATE).

This creates the gender-specific types (if needed) and also defines how much experience is needed to advance as well as what this advances to.

Definition at line 374 of file types.cpp.

References advances_to_, build_status_, cost_, CREATED, DBG_UT, experience_needed_, gender_types_, get_cfg(), i, image_, log_id(), utils::split(), type_name_, variation_name_, and variations_.

Referenced by apply_scenario_fix(), build(), and build_help_index().

◆ build_full()

void unit_type::build_full ( const movement_type_map movement_types,
const race_map races,
const config_array_view traits 
)
private

◆ build_help_index()

void unit_type::build_help_index ( const movement_type_map movement_types,
const race_map races,
const config_array_view traits 
)
private

◆ can_advance()

bool unit_type::can_advance ( ) const
inline

Definition at line 221 of file types.hpp.

References advances_to_.

Referenced by help::unit_topic_generator::operator()().

◆ check_id()

void unit_type::check_id ( std::string &  id)
static

Validate the id argument.

Replaces invalid characters in the reference with underscores.

Parameters
idThe proposed id for a unit_type.
Exceptions
errorif id starts with a space.

Definition at line 1459 of file types.cpp.

References c, and ERR_UT.

Referenced by get_unit_type(), and unit_type().

◆ cost()

int unit_type::cost ( ) const
inline

◆ create_sub_type()

std::unique_ptr< unit_type > unit_type::create_sub_type ( const config var_cfg,
bool  default_inherit 
)
private

Handles inheritance for configs of [male], [female], and [variation].

Also removes gendered children, as those serve no purpose. default_inherit is the default value for inherit=.

Definition at line 1031 of file types.cpp.

References config::clear_children(), get_cfg(), config::inherit_from(), and parent_id().

Referenced by fill_variations(), and fill_variations_and_gender().

◆ default_variation()

const std::string& unit_type::default_variation ( ) const
inline

Definition at line 173 of file types.hpp.

References default_variation_.

Referenced by unit::init().

◆ direct_special_notes()

std::vector<t_string> unit_type::direct_special_notes ( ) const
inline

Returns only the notes defined by [unit_type][special_note] tags, excluding any that would be found from abilities, attacks, etc.

Definition at line 155 of file types.hpp.

References special_notes_.

Referenced by unit::advance_to().

◆ do_not_list()

bool unit_type::do_not_list ( ) const
inline

Definition at line 278 of file types.hpp.

References do_not_list_.

◆ ellipse()

std::string unit_type::ellipse ( ) const
inline

Definition at line 181 of file types.hpp.

References get_cfg().

Referenced by unit::advance_to().

◆ events()

config::const_child_itors unit_type::events ( ) const
inline

Definition at line 239 of file types.hpp.

References config::child_range(), and get_cfg().

Referenced by unit::advance_to().

◆ experience_needed()

int unit_type::experience_needed ( bool  with_acceleration = true) const

◆ fill_variations()

void unit_type::fill_variations ( )
private

Processes [variation] tags of ut_cfg, handling inheritance and child clearing.

Definition at line 1048 of file types.cpp.

References create_sub_type(), debug_id_, ERR_CF, get_cfg(), and variations_.

Referenced by fill_variations_and_gender().

◆ fill_variations_and_gender()

void unit_type::fill_variations_and_gender ( )
private

◆ flag_rgb()

const std::string & unit_type::flag_rgb ( ) const

◆ genders()

const std::vector<unit_race::GENDER>& unit_type::genders ( ) const
inline

The returned vector will not be empty, provided this has been built to the HELP_INDEXED status.

Definition at line 248 of file types.hpp.

References genders_.

Referenced by help::unit_topic_generator::operator()(), and editor::mouse_action_unit::up_left().

◆ generate_name()

bool unit_type::generate_name ( ) const
inline

Definition at line 182 of file types.hpp.

References get_cfg().

Referenced by unit::advance_to().

◆ get_ability_list()

std::vector< std::string > unit_type::get_ability_list ( ) const

Definition at line 603 of file types.cpp.

References get_cfg(), and config::optional_child().

Referenced by wfl::unit_type_callable::get_value(), and impl_unit_type_get().

◆ get_cfg()

const config& unit_type::get_cfg ( ) const
inline

◆ get_gender_unit_type() [1/2]

const unit_type & unit_type::get_gender_unit_type ( std::string  gender) const

◆ get_gender_unit_type() [2/2]

const unit_type & unit_type::get_gender_unit_type ( unit_race::GENDER  gender) const

Returns a gendered variant of this unit_type based on the given parameter.

Definition at line 463 of file types.cpp.

References gender_types_, and i.

◆ get_variation()

const unit_type & unit_type::get_variation ( const std::string &  id) const

◆ halo()

std::string unit_type::halo ( ) const
inline

Definition at line 180 of file types.hpp.

References get_cfg().

Referenced by unit::advance_to().

◆ has_ability_by_id()

bool unit_type::has_ability_by_id ( const std::string &  ability) const

Definition at line 590 of file types.cpp.

References get_cfg().

◆ has_gender_variation()

bool unit_type::has_gender_variation ( const unit_race::GENDER  gender) const
inline

Definition at line 249 of file types.hpp.

References genders_.

Referenced by impl_unit_type_next(), and help::unit_topic_generator::operator()().

◆ has_random_traits()

bool unit_type::has_random_traits ( ) const

◆ has_variation()

bool unit_type::has_variation ( const std::string &  variation_id) const
Parameters
variation_idThe id of the variation we search for.
Returns
Whether one of the type's variations' (or the siblings' if the unit_type is a variation itself) id matches variation_id.

Definition at line 756 of file types.cpp.

References variation_id(), and variations_.

Referenced by unit::apply_builtin_effect(), and intf_transform_unit().

◆ has_zoc()

bool unit_type::has_zoc ( ) const
inline

Definition at line 225 of file types.hpp.

References zoc_.

Referenced by unit::advance_to().

◆ hide_help()

bool unit_type::hide_help ( ) const

◆ hitpoints()

int unit_type::hitpoints ( ) const
inline

◆ hp_bar_scaling()

double unit_type::hp_bar_scaling ( ) const
inline

Definition at line 162 of file types.hpp.

References hp_bar_scaling_.

Referenced by unit::advance_to(), and unit::init().

◆ icon()

const std::string& unit_type::icon ( ) const
inline

Definition at line 177 of file types.hpp.

References icon_.

Referenced by unit::absolute_image(), unit::default_anim_image(), impl_unit_type_get(), and unit::write().

◆ id()

const std::string& unit_type::id ( ) const
inline

◆ image()

const std::string& unit_type::image ( ) const
inline

◆ jamming()

int unit_type::jamming ( ) const
inline

Definition at line 170 of file types.hpp.

References jamming_.

Referenced by unit::advance_to(), and help::unit_topic_generator::operator()().

◆ level()

int unit_type::level ( ) const
inline

◆ log_id()

const std::string unit_type::log_id ( ) const
inline

A variant on id() that is more descriptive, for use with message logging.

Definition at line 143 of file types.hpp.

References debug_id_, and id_.

Referenced by unit::advances_to_translated(), build(), build_created(), and unit::generate_traits().

◆ max_attacks()

int unit_type::max_attacks ( ) const
inline

Definition at line 171 of file types.hpp.

References max_attacks_.

Referenced by unit::advance_to().

◆ modification_advancements()

config::const_child_itors unit_type::modification_advancements ( ) const
inline

Returns two iterators pointing to a range of AMLA configs.

Definition at line 120 of file types.hpp.

References config::child_range(), and get_cfg().

Referenced by help::unit_topic_generator::operator()().

◆ movement()

int unit_type::movement ( ) const
inline

◆ movement_type()

const movetype& unit_type::movement_type ( ) const
inline

◆ musthave_status()

bool unit_type::musthave_status ( const std::string &  status) const

◆ num_traits()

unsigned int unit_type::num_traits ( ) const
inline

◆ operator=()

unit_type& unit_type::operator= ( const unit_type o)
privatedelete

◆ parent_id()

const std::string& unit_type::parent_id ( ) const
inline

◆ possible_traits()

config::const_child_itors unit_type::possible_traits ( ) const
inline

◆ race()

const unit_race* unit_type::race ( ) const
inline

Never returns nullptr, but may point to the null race.

Requires building to the HELP_INDEXED status to get the correct race.

Definition at line 276 of file types.hpp.

References race_.

Referenced by unit::advance_to(), and help::unit_topic_generator::operator()().

◆ race_id()

std::string unit_type::race_id ( ) const
inline

Returns the ID of this type's race without the need to build the type.

Definition at line 271 of file types.hpp.

References get_cfg().

Referenced by wfl::unit_type_callable::get_value(), impl_unit_type_get(), and help::unit_topic_generator::operator()().

◆ recall_cost()

int unit_type::recall_cost ( ) const
inline

Definition at line 165 of file types.hpp.

References recall_cost_.

Referenced by unit::advance_to(), wfl::unit_type_callable::get_value(), and impl_unit_type_get().

◆ remove_scenario_fixes()

void unit_type::remove_scenario_fixes ( )

◆ resistance_against()

int unit_type::resistance_against ( const std::string &  damage_name,
bool  attacker 
) const

◆ resistance_filter_matches()

bool unit_type::resistance_filter_matches ( const config cfg,
bool  attacker,
const std::string &  damage_name,
int  res 
) const
private

Identical to unit::resistance_filter_matches.

Definition at line 803 of file types.cpp.

References unit_abilities::filter_base_matches(), and utils::split().

Referenced by resistance_against().

◆ show_variations_in_help()

bool unit_type::show_variations_in_help ( ) const

Whether the unit type has at least one help-visible variation.

Definition at line 761 of file types.cpp.

References variations_.

Referenced by help::unit_topic_generator::operator()(), unit_defense(), and unit_type().

◆ small_profile()

const std::string& unit_type::small_profile ( ) const
inline

◆ special_notes()

std::vector< t_string > unit_type::special_notes ( ) const

Returns all notes that should be displayed in the help page for this type, including those found in abilities and attacks.

Definition at line 492 of file types.cpp.

References abilities_cfg(), attacks(), combine_special_notes(), movement_type(), and special_notes_.

Referenced by help::unit_topic_generator::operator()().

◆ type_name()

const t_string& unit_type::type_name ( ) const
inline

◆ undead_variation()

const std::string& unit_type::undead_variation ( ) const
inline

Info on the type of unit that the unit reanimates as.

Definition at line 133 of file types.hpp.

References undead_variation_.

Referenced by unit::advance_to(), and battle_context_unit_stats::battle_context_unit_stats().

◆ unit_description()

t_string unit_type::unit_description ( ) const

◆ usage()

const std::string& unit_type::usage ( ) const
inline

◆ variation_id()

const std::string& unit_type::variation_id ( ) const
inline

The id of this variation; empty if it's a gender variation or a base unit.

Definition at line 147 of file types.hpp.

References variation_id_.

Referenced by unit::advance_to(), and has_variation().

◆ variation_name()

const t_string& unit_type::variation_name ( ) const
inline

◆ variation_types()

const variations_map& unit_type::variation_types ( ) const
inline

Definition at line 255 of file types.hpp.

References variations_.

Referenced by impl_unit_type_next().

◆ variations()

std::vector< std::string > unit_type::variations ( ) const

Definition at line 744 of file types.cpp.

References variations_.

Referenced by help::unit_topic_generator::operator()().

◆ vision() [1/2]

int unit_type::vision ( ) const
inline

Definition at line 167 of file types.hpp.

References movement(), and vision_.

Referenced by unit::advance_to(), and help::unit_topic_generator::operator()().

◆ vision() [2/2]

int unit_type::vision ( bool  base_value) const
inline

If base_value is set to true, do not fall back to movement().

Definition at line 169 of file types.hpp.

References vision(), and vision_.

Referenced by vision().

◆ writable_cfg()

config& unit_type::writable_cfg ( )
inlineprivate

Definition at line 303 of file types.hpp.

References built_cfg_, and cfg_.

◆ xp_bar_scaling()

double unit_type::xp_bar_scaling ( ) const
inline

Definition at line 163 of file types.hpp.

References xp_bar_scaling_.

Referenced by unit::advance_to(), and unit::init().

Friends And Related Function Documentation

◆ unit_type_data

friend class unit_type_data
friend

Definition at line 316 of file types.hpp.

Member Data Documentation

◆ abilities_

std::vector<ability_metadata> unit_type::abilities_
private

Definition at line 361 of file types.hpp.

Referenced by abilities_metadata(), and build_help_index().

◆ adv_abilities_

std::vector<ability_metadata> unit_type::adv_abilities_
private

Definition at line 361 of file types.hpp.

Referenced by adv_abilities_metadata(), and build_help_index().

◆ advances_to_

std::vector<std::string> unit_type::advances_to_
private

◆ alignment_

unit_alignments::type unit_type::alignment_
private

Definition at line 369 of file types.hpp.

Referenced by alignment(), and build_help_index().

◆ animations_

std::vector<unit_animation> unit_type::animations_
mutableprivate

Definition at line 378 of file types.hpp.

Referenced by animations().

◆ attacks_cache_

attack_list unit_type::attacks_cache_
mutableprivate

Definition at line 319 of file types.hpp.

Referenced by attacks().

◆ base_unit_id_

std::string unit_type::base_unit_id_
private

from [base_unit]

Definition at line 327 of file types.hpp.

Referenced by unit_type().

◆ build_status_

BUILD_STATUS unit_type::build_status_
private

Definition at line 380 of file types.hpp.

Referenced by build_created(), build_full(), and build_help_index().

◆ built_cfg_

std::unique_ptr<config> unit_type::built_cfg_
mutableprivate

Definition at line 317 of file types.hpp.

Referenced by get_cfg(), unit_type(), and writable_cfg().

◆ cfg_

const config* unit_type::cfg_
private

Definition at line 315 of file types.hpp.

Referenced by get_cfg(), unit_type(), and writable_cfg().

◆ cost_

int unit_type::cost_
private

Definition at line 339 of file types.hpp.

Referenced by apply_scenario_fix(), build_created(), cost(), and remove_scenario_fixes().

◆ debug_id_

std::string unit_type::debug_id_
private

A suffix for id_, used when logging messages.

Definition at line 323 of file types.hpp.

Referenced by fill_variations(), and log_id().

◆ default_variation_

std::string unit_type::default_variation_
private

Definition at line 354 of file types.hpp.

Referenced by build_help_index(), and default_variation().

◆ description_

t_string unit_type::description_
private

Definition at line 329 of file types.hpp.

Referenced by build_help_index(), and unit_description().

◆ do_not_list_

bool unit_type::do_not_list_
private

Definition at line 363 of file types.hpp.

Referenced by build_help_index(), and do_not_list().

◆ experience_needed_

int unit_type::experience_needed_
private

◆ flag_rgb_

std::string unit_type::flag_rgb_
private

Definition at line 347 of file types.hpp.

Referenced by build_help_index(), and flag_rgb().

◆ gender_types_

std::array<std::unique_ptr<unit_type>, 2> unit_type::gender_types_
private

◆ genders_

std::vector<unit_race::GENDER> unit_type::genders_
private

Definition at line 375 of file types.hpp.

Referenced by build_help_index(), genders(), and has_gender_variation().

◆ has_cfg_build_

bool unit_type::has_cfg_build_
mutableprivate

Definition at line 318 of file types.hpp.

◆ hide_help_

bool unit_type::hide_help_
private

Definition at line 363 of file types.hpp.

Referenced by build_help_index(), and hide_help().

◆ hitpoints_

int unit_type::hitpoints_
private

Definition at line 331 of file types.hpp.

Referenced by build_help_index(), and hitpoints().

◆ hp_bar_scaling_

double unit_type::hp_bar_scaling_
private

Definition at line 332 of file types.hpp.

Referenced by build_full(), and hp_bar_scaling().

◆ icon_

std::string unit_type::icon_
private

Definition at line 344 of file types.hpp.

Referenced by build_help_index(), and icon().

◆ id_

std::string unit_type::id_
private

Definition at line 321 of file types.hpp.

Referenced by advancement_tree(), advances_from(), hide_help(), id(), log_id(), and unit_type().

◆ image_

std::string unit_type::image_
private

Definition at line 343 of file types.hpp.

Referenced by build_created(), and image().

◆ jamming_

int unit_type::jamming_
private

Definition at line 337 of file types.hpp.

Referenced by build_help_index(), and jamming().

◆ level_

int unit_type::level_
private

Definition at line 333 of file types.hpp.

Referenced by build_full(), build_help_index(), and level().

◆ max_attacks_

int unit_type::max_attacks_
private

Definition at line 338 of file types.hpp.

Referenced by build_help_index(), and max_attacks().

◆ movement_

int unit_type::movement_
private

Definition at line 335 of file types.hpp.

Referenced by build_help_index(), and movement().

◆ movement_type_

movetype unit_type::movement_type_
private

Definition at line 371 of file types.hpp.

Referenced by build_help_index(), movement_type(), and resistance_against().

◆ num_traits_

unsigned int unit_type::num_traits_
private

Definition at line 349 of file types.hpp.

Referenced by build_help_index(), and num_traits().

◆ parent_id_

std::string unit_type::parent_id_
private

The id of the top ancestor of this unit_type.

Definition at line 325 of file types.hpp.

Referenced by parent_id(), and unit_type().

◆ possible_traits_

config unit_type::possible_traits_
private

Definition at line 373 of file types.hpp.

Referenced by build_help_index(), and possible_traits().

◆ profile_

std::string unit_type::profile_
private

Definition at line 346 of file types.hpp.

Referenced by big_profile(), and build_help_index().

◆ race_

const unit_race* unit_type::race_
private

Never nullptr, but may point to the null race.

Definition at line 359 of file types.hpp.

Referenced by build_full(), build_help_index(), hide_help(), and race().

◆ recall_cost_

int unit_type::recall_cost_
private

Definition at line 334 of file types.hpp.

Referenced by build_help_index(), and recall_cost().

◆ small_profile_

std::string unit_type::small_profile_
private

Definition at line 345 of file types.hpp.

Referenced by build_help_index(), and small_profile().

◆ special_notes_

std::vector<t_string> unit_type::special_notes_
private

Definition at line 330 of file types.hpp.

Referenced by build_help_index(), direct_special_notes(), and special_notes().

◆ type_name_

t_string unit_type::type_name_
private

Definition at line 328 of file types.hpp.

Referenced by build_created(), build_help_index(), and type_name().

◆ undead_variation_

std::string unit_type::undead_variation_
private

Definition at line 341 of file types.hpp.

Referenced by build_full(), build_help_index(), and undead_variation().

◆ usage_

std::string unit_type::usage_
private

Definition at line 340 of file types.hpp.

Referenced by build_help_index(), and usage().

◆ variation_id_

std::string unit_type::variation_id_
private

Definition at line 355 of file types.hpp.

Referenced by variation_id().

◆ variation_name_

t_string unit_type::variation_name_
private

Definition at line 356 of file types.hpp.

Referenced by build_created(), and variation_name().

◆ variations_

variations_map unit_type::variations_
private

◆ vision_

int unit_type::vision_
private

Definition at line 336 of file types.hpp.

Referenced by build_help_index(), and vision().

◆ xp_bar_scaling_

double unit_type::xp_bar_scaling_
private

Definition at line 332 of file types.hpp.

Referenced by build_full(), and xp_bar_scaling().

◆ zoc_

bool unit_type::zoc_
private

Definition at line 363 of file types.hpp.

Referenced by build_full(), and has_zoc().


The documentation for this class was generated from the following files: