The Battle for Wesnoth  1.15.2+dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | 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
 
class  error
 

Public Types

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

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 (const unit_type &o)
 
 ~unit_type ()
 
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. More...
 
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. More...
 
void add_advancement (const unit_type &advance_to, int experience)
 Adds an additional advancement path to a unit type. 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 & base_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
 
bool has_special_notes () const
 
const std::vector< t_string > & special_notes () const
 
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
 
 MAKE_ENUM (ALIGNMENT,(LAWFUL, N_("lawful"))(NEUTRAL, N_("neutral"))(CHAOTIC, N_("chaotic"))(LIMINAL, N_("liminal"))) ALIGNMENT 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
 
const configget_cfg_for_units () const
 Returns a trimmed config suitable for use with units. More...
 
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 (ALIGNMENT align, unit_race::GENDER gender=unit_race::MALE)
 

Private Types

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

Private Member Functions

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). More...
 
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). More...
 
void build_created ()
 Load the most needed data into an empty unit_type (build to CREATE). More...
 
const configbuild_unit_cfg () const
 Generates (and returns) a trimmed config suitable for use with units. 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...
 
void operator= (const unit_type &o)
 

Private Attributes

const configcfg_
 
config unit_cfg_
 
bool built_unit_cfg_
 Generated as needed via get_cfg_for_units(). More...
 
attack_list attacks_cache_
 
std::string id_
 
std::string debug_id_
 
std::string base_id_
 A suffix for id_, used when logging messages. More...
 
t_string type_name_
 The id of the top ancestor of this unit_type. More...
 
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_
 
std::vector< ability_metadataabilities_
 Never nullptr, but may point to the null race. More...
 
std::vector< ability_metadataadv_abilities_
 
bool zoc_
 
bool hide_help_
 
bool do_not_list_
 
std::vector< std::string > advances_to_
 
int experience_needed_
 
bool in_advancefrom_
 
ALIGNMENT alignment_
 
movetype movement_type_
 
config possible_traits_
 
std::vector< unit_race::GENDERgenders_
 
std::vector< unit_animationanimations_
 
BUILD_STATUS build_status_
 

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

◆ variations_map

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

Definition at line 87 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 67 of file types.hpp.

Constructor & Destructor Documentation

◆ unit_type() [1/2]

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 103 of file types.cpp.

References base_id_, check_id(), and id_.

Referenced by build_created(), build_help_index(), unit_type::error::error(), and unit_type().

◆ unit_type() [2/2]

unit_type::unit_type ( const unit_type o)

Definition at line 53 of file types.cpp.

References gender_types_, and unit_type().

◆ ~unit_type()

unit_type::~unit_type ( )

Definition at line 154 of file types.cpp.

Referenced by unit_type::error::error().

Member Function Documentation

◆ abilities_cfg()

const config& unit_type::abilities_cfg ( ) const
inline

Definition at line 229 of file types.hpp.

References cfg_, and config::child_or_empty().

Referenced by unit::advance_to().

◆ abilities_metadata()

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

Definition at line 212 of file types.hpp.

References abilities_.

Referenced by help::generate_ability_topics(), and gui2::unit_preview_pane::set_displayed_type().

◆ add_advancement()

void unit_type::add_advancement ( const unit_type advance_to,
int  experience 
)

Adds an additional advancement path to a unit type.

This is used to implement the [advancefrom] tag.

Definition at line 595 of file types.cpp.

References unit_type_data::build_unit_type(), DBG_UT, gui2::event::find(), gender_types_, id_, LOG_CONFIG, log_id(), unit_types, and WRN_CF.

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

◆ 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 215 of file types.hpp.

References adv_abilities_.

Referenced by help::generate_ability_topics().

◆ 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 672 of file types.cpp.

References advancement_tree_internal().

Referenced by build(), and ai::default_recruitment::recruitment::do_similarity_penalty().

◆ advancements()

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

Definition at line 232 of file types.hpp.

References cfg_, and config::child_range().

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 679 of file types.cpp.

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

Referenced by advances_to(), and impl_unit_type_get().

◆ 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 112 of file types.hpp.

References advances_from(), and advances_to_.

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

◆ alignment_description()

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

◆ animations()

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

Definition at line 500 of file types.cpp.

References animations_, and cfg_.

Referenced by generate_name(), and unit_animation_component::reset_after_advance().

◆ apply_scenario_fix()

void unit_type::apply_scenario_fix ( const config cfg)

◆ attacks()

const_attack_itors unit_type::attacks ( ) const

◆ base_id()

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

The id of the original type from which this (variation) descended.

Definition at line 142 of file types.hpp.

References base_id_.

Referenced by unit::apply_builtin_effect(), battle_context_unit_stats::battle_context_unit_stats(), statistics::recruit_unit(), statistics::un_recruit_unit(), actions::undo::recruit_action::write(), and unit::write().

◆ big_profile()

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

Definition at line 168 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::const_child_itors traits 
)

Performs a build of this to the indicated stage.

Definition at line 416 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::const_child_itors 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 94 of file types.hpp.

References add_advancement(), advancement_tree(), and 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 371 of file types.cpp.

References advances_to_, build_status_, cfg_, config::child(), cost_, CREATED, DBG_UT, debug_id_, experience_needed_, gender_types_, i, id_, log_id(), utils::split(), and unit_type().

Referenced by build(), and build_help_index().

◆ build_full()

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

◆ build_help_index()

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

◆ build_unit_cfg()

const config & unit_type::build_unit_cfg ( ) const
private

Generates (and returns) a trimmed config suitable for use with units.

Definition at line 803 of file types.cpp.

References config::append_attributes().

Referenced by get_cfg_for_units().

◆ can_advance()

bool unit_type::can_advance ( ) const
inline

Definition at line 217 of file types.hpp.

References advances_to_, and musthave_status().

◆ 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 1503 of file types.cpp.

References c, ERR_UT, and error().

Referenced by get_unit_type(), and unit_type().

◆ cost()

int unit_type::cost ( ) const
inline

◆ default_variation()

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

Definition at line 162 of file types.hpp.

References default_variation_.

Referenced by unit::init().

◆ do_not_list()

bool unit_type::do_not_list ( ) const
inline

Definition at line 270 of file types.hpp.

References do_not_list_.

◆ ellipse()

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

Definition at line 170 of file types.hpp.

References cfg_.

Referenced by unit::advance_to().

◆ events()

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

Definition at line 235 of file types.hpp.

References cfg_, config::child_range(), and has_random_traits().

Referenced by unit::advance_to().

◆ experience_needed()

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

◆ 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 242 of file types.hpp.

References genders_.

Referenced by events::menu_handler::current_unit(), help::generate_faction_topics(), generate_gender(), help::generate_unit_topics(), gui2::unit_preview_pane::set_displayed_type(), and editor::mouse_action_unit::up_left().

◆ generate_name()

bool unit_type::generate_name ( ) const
inline

Definition at line 171 of file types.hpp.

References animations(), attacks(), cfg_, and flag_rgb().

Referenced by unit::advance_to().

◆ get_ability_list()

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

Definition at line 570 of file types.cpp.

References config::all_children_range(), and config::child().

Referenced by has_zoc(), and impl_unit_type_get().

◆ get_cfg()

const config& unit_type::get_cfg ( ) const
inline

◆ get_cfg_for_units()

const config& unit_type::get_cfg_for_units ( ) const
inline

Returns a trimmed config suitable for use with units.

Definition at line 274 of file types.hpp.

References apply_scenario_fix(), build_unit_cfg(), built_unit_cfg_, operator=(), remove_scenario_fixes(), resistance_against(), resistance_filter_matches(), and unit_cfg_.

Referenced by unit::advance_to().

◆ 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 462 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 169 of file types.hpp.

References 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 557 of file types.cpp.

References config::child().

Referenced by has_zoc().

◆ has_gender_variation()

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

Definition at line 243 of file types.hpp.

References gui2::event::find(), genders_, and variations().

Referenced by impl_unit_type_next().

◆ has_random_traits()

bool unit_type::has_random_traits ( ) const

Definition at line 752 of file types.cpp.

References config_attribute_value::blank(), and config_attribute_value::str().

Referenced by events().

◆ has_special_notes()

bool unit_type::has_special_notes ( ) const

Definition at line 491 of file types.cpp.

References special_notes_.

Referenced by variation_id().

◆ 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 784 of file types.cpp.

Referenced by unit_filter_impl::unit_filter_compound::fill(), intf_transform_unit(), and variation_types().

◆ has_zoc()

bool unit_type::has_zoc ( ) const
inline

Definition at line 221 of file types.hpp.

References get_ability_list(), has_ability_by_id(), and 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 151 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

◆ 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 159 of file types.hpp.

References jamming_.

Referenced by unit::advance_to().

◆ 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 140 of file types.hpp.

References debug_id_, and id_.

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

◆ MAKE_ENUM()

unit_type::MAKE_ENUM ( ALIGNMENT  ,
(LAWFUL, N_("lawful"))(NEUTRAL, N_("neutral"))(CHAOTIC, N_("chaotic"))(LIMINAL, N_("liminal"))   
) const
inline

Definition at line 181 of file types.hpp.

References alignment_, alignment_description(), and unit_race::MALE.

◆ max_attacks()

int unit_type::max_attacks ( ) const
inline

Definition at line 160 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 117 of file types.hpp.

References cfg_, config::child_range(), get_gender_unit_type(), and get_variation().

Referenced by help::generate_weapon_special_topics().

◆ 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

Definition at line 132 of file types.hpp.

References num_traits_.

Referenced by unit::generate_traits().

◆ operator=()

void unit_type::operator= ( const unit_type o)
private

Referenced by get_cfg_for_units().

◆ 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 268 of file types.hpp.

References hide_help(), and race_.

Referenced by unit::advance_to(), and gui2::unit_preview_pane::set_displayed_type().

◆ 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 265 of file types.hpp.

References cfg_.

Referenced by unit_type_data::build_unit_type(), help::generate_faction_topics(), help::generate_races_sections(), help::generate_trait_topics(), help::generate_unit_sections(), help::generate_unit_topics(), and impl_unit_type_get().

◆ recall_cost()

int unit_type::recall_cost ( ) const
inline

Definition at line 154 of file types.hpp.

References recall_cost_.

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

◆ remove_scenario_fixes()

void unit_type::remove_scenario_fixes ( )

Definition at line 1474 of file types.cpp.

References utils::split().

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

◆ 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

◆ show_variations_in_help()

bool unit_type::show_variations_in_help ( ) const

◆ small_profile()

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

◆ special_notes()

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

Definition at line 496 of file types.cpp.

References special_notes_.

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

◆ 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 130 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

Definition at line 482 of file types.cpp.

References _(), description_, and t_string::empty().

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

◆ usage()

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

Definition at line 164 of file types.hpp.

References usage_.

Referenced by unit::advance_to(), and ai::default_recruitment::recruitment::recruit_matches_type().

◆ 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 144 of file types.hpp.

References has_special_notes(), special_notes(), unit_description(), and variation_id_.

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

◆ variation_name()

const t_string& unit_type::variation_name ( ) const
inline

Definition at line 163 of file types.hpp.

References variation_name_.

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

◆ variation_types()

const variations_map& unit_type::variation_types ( ) const
inline

Definition at line 249 of file types.hpp.

References has_variation(), show_variations_in_help(), variation_id(), and variations_.

Referenced by impl_unit_type_next().

◆ variations()

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

◆ vision() [1/2]

int unit_type::vision ( ) const
inline

Definition at line 156 of file types.hpp.

References movement(), and vision_.

Referenced by unit::advance_to().

◆ 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 158 of file types.hpp.

References vision(), and vision_.

Referenced by vision().

◆ xp_bar_scaling()

double unit_type::xp_bar_scaling ( ) const
inline

Definition at line 152 of file types.hpp.

References xp_bar_scaling_.

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

Member Data Documentation

◆ abilities_

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

Never nullptr, but may point to the null race.

Definition at line 333 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 333 of file types.hpp.

Referenced by adv_abilities_metadata(), and build_help_index().

◆ advances_to_

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

Definition at line 337 of file types.hpp.

Referenced by advances_to(), build_created(), and can_advance().

◆ alignment_

ALIGNMENT unit_type::alignment_
private

Definition at line 342 of file types.hpp.

Referenced by build_help_index(), and MAKE_ENUM().

◆ animations_

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

Definition at line 351 of file types.hpp.

Referenced by animations().

◆ attacks_cache_

attack_list unit_type::attacks_cache_
mutableprivate

Definition at line 296 of file types.hpp.

Referenced by attacks().

◆ base_id_

std::string unit_type::base_id_
private

A suffix for id_, used when logging messages.

Definition at line 300 of file types.hpp.

Referenced by base_id(), build_help_index(), and unit_type().

◆ build_status_

BUILD_STATUS unit_type::build_status_
private

Definition at line 353 of file types.hpp.

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

◆ built_unit_cfg_

bool unit_type::built_unit_cfg_
mutableprivate

Generated as needed via get_cfg_for_units().

Definition at line 295 of file types.hpp.

Referenced by get_cfg_for_units().

◆ cfg_

const config& unit_type::cfg_
private

◆ cost_

int unit_type::cost_
private

Definition at line 312 of file types.hpp.

Referenced by build_created(), and cost().

◆ debug_id_

std::string unit_type::debug_id_
private

Definition at line 299 of file types.hpp.

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

◆ default_variation_

std::string unit_type::default_variation_
private

Definition at line 327 of file types.hpp.

Referenced by default_variation().

◆ description_

t_string unit_type::description_
private

Definition at line 302 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 335 of file types.hpp.

Referenced by do_not_list().

◆ experience_needed_

int unit_type::experience_needed_
private

Definition at line 338 of file types.hpp.

Referenced by build_created().

◆ flag_rgb_

std::string unit_type::flag_rgb_
private

Definition at line 320 of file types.hpp.

◆ 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 348 of file types.hpp.

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

◆ hide_help_

bool unit_type::hide_help_
private

Definition at line 335 of file types.hpp.

Referenced by build_help_index().

◆ hitpoints_

int unit_type::hitpoints_
private

Definition at line 304 of file types.hpp.

Referenced by build_help_index(), and hitpoints().

◆ hp_bar_scaling_

double unit_type::hp_bar_scaling_
private

Definition at line 305 of file types.hpp.

Referenced by build_full(), and hp_bar_scaling().

◆ icon_

std::string unit_type::icon_
private

Definition at line 317 of file types.hpp.

Referenced by build_help_index(), and icon().

◆ id_

std::string unit_type::id_
private

Definition at line 298 of file types.hpp.

Referenced by add_advancement(), build_created(), build_help_index(), id(), log_id(), and unit_type().

◆ image_

std::string unit_type::image_
private

Definition at line 316 of file types.hpp.

Referenced by build_help_index(), and image().

◆ in_advancefrom_

bool unit_type::in_advancefrom_
private

Definition at line 339 of file types.hpp.

◆ jamming_

int unit_type::jamming_
private

Definition at line 310 of file types.hpp.

Referenced by build_help_index(), and jamming().

◆ level_

int unit_type::level_
private

Definition at line 306 of file types.hpp.

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

◆ max_attacks_

int unit_type::max_attacks_
private

Definition at line 311 of file types.hpp.

Referenced by build_help_index(), and max_attacks().

◆ movement_

int unit_type::movement_
private

Definition at line 308 of file types.hpp.

Referenced by build_help_index(), and movement().

◆ movement_type_

movetype unit_type::movement_type_
private

Definition at line 344 of file types.hpp.

Referenced by build_help_index(), and movement_type().

◆ num_traits_

unsigned int unit_type::num_traits_
private

Definition at line 322 of file types.hpp.

Referenced by build_help_index(), and num_traits().

◆ possible_traits_

config unit_type::possible_traits_
private

Definition at line 346 of file types.hpp.

Referenced by build_help_index(), and possible_traits().

◆ profile_

std::string unit_type::profile_
private

Definition at line 319 of file types.hpp.

Referenced by big_profile(), and build_help_index().

◆ race_

const unit_race* unit_type::race_
private

Definition at line 331 of file types.hpp.

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

◆ recall_cost_

int unit_type::recall_cost_
private

Definition at line 307 of file types.hpp.

Referenced by build_help_index(), and recall_cost().

◆ small_profile_

std::string unit_type::small_profile_
private

Definition at line 318 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 303 of file types.hpp.

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

◆ type_name_

t_string unit_type::type_name_
private

The id of the top ancestor of this unit_type.

Definition at line 301 of file types.hpp.

Referenced by build_help_index(), and type_name().

◆ undead_variation_

std::string unit_type::undead_variation_
private

Definition at line 314 of file types.hpp.

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

◆ unit_cfg_

config unit_type::unit_cfg_
mutableprivate

◆ usage_

std::string unit_type::usage_
private

Definition at line 313 of file types.hpp.

Referenced by build_help_index(), and usage().

◆ variation_id_

std::string unit_type::variation_id_
private

Definition at line 328 of file types.hpp.

Referenced by variation_id().

◆ variation_name_

t_string unit_type::variation_name_
private

Definition at line 329 of file types.hpp.

Referenced by variation_name().

◆ variations_

variations_map unit_type::variations_
private

Definition at line 326 of file types.hpp.

Referenced by build_full(), build_help_index(), get_variation(), and variation_types().

◆ vision_

int unit_type::vision_
private

Definition at line 309 of file types.hpp.

Referenced by build_help_index(), and vision().

◆ xp_bar_scaling_

double unit_type::xp_bar_scaling_
private

Definition at line 305 of file types.hpp.

Referenced by build_full(), and xp_bar_scaling().

◆ zoc_

bool unit_type::zoc_
private

Definition at line 335 of file types.hpp.

Referenced by build_full(), and has_zoc().


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