The Battle for Wesnoth  1.17.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
 
using ALIGNMENT = UNIT_ALIGNMENT
 

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

 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_
 
ALIGNMENT 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 45 of file types.hpp.

Member Typedef Documentation

◆ ALIGNMENT

using unit_type::ALIGNMENT = UNIT_ALIGNMENT

Definition at line 195 of file types.hpp.

◆ error

Definition at line 52 of file types.hpp.

◆ variations_map

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

Definition at line 97 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 77 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 104 of file types.cpp.

References base_unit_id_, check_id(), config::child(), id_, LOG_UT, 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 158 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 165 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 56 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 172 of file types.cpp.

Member Function Documentation

◆ abilities_cfg()

const config& unit_type::abilities_cfg ( ) const
inline

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

References abilities_.

Referenced by help::generate_ability_topics(), and gui2::unit_preview_pane::set_displayed_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 224 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 648 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 241 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 655 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 118 of file types.hpp.

References advances_from(), and advances_to_.

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

◆ alignment()

ALIGNMENT unit_type::alignment ( ) const
inline

◆ 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

◆ 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 182 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 421 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 106 of file types.hpp.

References 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 378 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 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 226 of file types.hpp.

References advances_to_, and musthave_status().

Referenced by gui2::unit_preview_pane::set_displayed_type().

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

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

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

Referenced by writable_cfg().

◆ default_variation()

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

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

References special_notes(), and special_notes_.

Referenced by unit::advance_to().

◆ do_not_list()

bool unit_type::do_not_list ( ) const
inline

Definition at line 283 of file types.hpp.

References do_not_list_.

◆ ellipse()

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

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

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

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

References built_cfg_, debug_id_, ERR_CF, and variation_id_.

Referenced by writable_cfg().

◆ fill_variations_and_gender()

void unit_type::fill_variations_and_gender ( )
private

Definition at line 1074 of file types.cpp.

References gui2::dialogs::loading_screen::progress().

Referenced by writable_cfg().

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

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

Referenced by unit::advance_to().

◆ get_ability_list()

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

Definition at line 607 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_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 467 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 183 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 594 of file types.cpp.

Referenced by has_zoc().

◆ has_gender_variation()

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

Definition at line 254 of file types.hpp.

References genders_, and variations().

Referenced by impl_unit_type_next().

◆ has_random_traits()

bool unit_type::has_random_traits ( ) const

Definition at line 728 of file types.cpp.

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

Referenced by events().

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

Referenced by unit::apply_builtin_effect(), 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 230 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 165 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 173 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 146 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 174 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 123 of file types.hpp.

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

Referenced by help::generate_weapon_special_topics(), and unit_helper::unit_level_tooltip().

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

References num_traits_.

Referenced by unit::generate_traits().

◆ operator=()

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

Referenced by writable_cfg().

◆ parent_id()

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

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

Definition at line 148 of file types.hpp.

References parent_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().

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

References get_cfg().

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

◆ recall_cost()

int unit_type::recall_cost ( ) const
inline

Definition at line 168 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 1427 of file types.cpp.

References utils::split().

Referenced by get_cfg(), and unit_type_data::traits().

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

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

Referenced by get_cfg().

◆ 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()

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

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

Referenced by direct_special_notes().

◆ 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 136 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 487 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 178 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 150 of file types.hpp.

References unit_description(), and variation_id_.

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

◆ 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 260 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 170 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 172 of file types.hpp.

References vision(), and vision_.

Referenced by vision().

◆ writable_cfg()

config& unit_type::writable_cfg ( )
inlineprivate

◆ xp_bar_scaling()

double unit_type::xp_bar_scaling ( ) const
inline

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

Member Data Documentation

◆ abilities_

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

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

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

◆ alignment_

ALIGNMENT unit_type::alignment_
private

Definition at line 374 of file types.hpp.

Referenced by alignment(), and build_help_index().

◆ animations_

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

Definition at line 383 of file types.hpp.

Referenced by animations().

◆ attacks_cache_

attack_list unit_type::attacks_cache_
mutableprivate

Definition at line 324 of file types.hpp.

Referenced by attacks().

◆ base_unit_id_

std::string unit_type::base_unit_id_
private

from [base_unit]

Definition at line 332 of file types.hpp.

Referenced by unit_type_data::apply_base_unit(), and unit_type().

◆ build_status_

BUILD_STATUS unit_type::build_status_
private

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

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

◆ cfg_

const config* unit_type::cfg_
private

Definition at line 320 of file types.hpp.

Referenced by get_cfg(), and unit_type().

◆ cost_

int unit_type::cost_
private

Definition at line 344 of file types.hpp.

Referenced by build_created(), and cost().

◆ debug_id_

std::string unit_type::debug_id_
private

A suffix for id_, used when logging messages.

Definition at line 328 of file types.hpp.

Referenced by fill_variations(), and log_id().

◆ default_variation_

std::string unit_type::default_variation_
private

Definition at line 359 of file types.hpp.

Referenced by build_help_index(), and default_variation().

◆ description_

t_string unit_type::description_
private

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

Referenced by build_help_index(), and do_not_list().

◆ experience_needed_

int unit_type::experience_needed_
private

Definition at line 371 of file types.hpp.

Referenced by build_created().

◆ flag_rgb_

std::string unit_type::flag_rgb_
private

Definition at line 352 of file types.hpp.

Referenced by build_help_index().

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

◆ hide_help_

bool unit_type::hide_help_
private

Definition at line 368 of file types.hpp.

Referenced by build_help_index().

◆ hitpoints_

int unit_type::hitpoints_
private

Definition at line 336 of file types.hpp.

Referenced by build_help_index(), and hitpoints().

◆ hp_bar_scaling_

double unit_type::hp_bar_scaling_
private

Definition at line 337 of file types.hpp.

Referenced by build_full(), and hp_bar_scaling().

◆ icon_

std::string unit_type::icon_
private

Definition at line 349 of file types.hpp.

Referenced by build_help_index(), and icon().

◆ id_

std::string unit_type::id_
private

Definition at line 326 of file types.hpp.

Referenced by id(), log_id(), and unit_type().

◆ image_

std::string unit_type::image_
private

Definition at line 348 of file types.hpp.

Referenced by build_created(), and image().

◆ jamming_

int unit_type::jamming_
private

Definition at line 342 of file types.hpp.

Referenced by build_help_index(), and jamming().

◆ level_

int unit_type::level_
private

Definition at line 338 of file types.hpp.

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

◆ max_attacks_

int unit_type::max_attacks_
private

Definition at line 343 of file types.hpp.

Referenced by build_help_index(), and max_attacks().

◆ movement_

int unit_type::movement_
private

Definition at line 340 of file types.hpp.

Referenced by build_help_index(), and movement().

◆ movement_type_

movetype unit_type::movement_type_
private

Definition at line 376 of file types.hpp.

Referenced by build_help_index(), and movement_type().

◆ num_traits_

unsigned int unit_type::num_traits_
private

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

Referenced by parent_id(), and unit_type().

◆ possible_traits_

config unit_type::possible_traits_
private

Definition at line 378 of file types.hpp.

Referenced by build_help_index(), and possible_traits().

◆ profile_

std::string unit_type::profile_
private

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

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

◆ recall_cost_

int unit_type::recall_cost_
private

Definition at line 339 of file types.hpp.

Referenced by build_help_index(), and recall_cost().

◆ small_profile_

std::string unit_type::small_profile_
private

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

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

◆ usage_

std::string unit_type::usage_
private

Definition at line 345 of file types.hpp.

Referenced by build_help_index(), and usage().

◆ variation_id_

std::string unit_type::variation_id_
private

Definition at line 360 of file types.hpp.

Referenced by fill_variations(), and variation_id().

◆ variation_name_

t_string unit_type::variation_name_
private

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

Referenced by build_help_index(), and vision().

◆ xp_bar_scaling_

double unit_type::xp_bar_scaling_
private

Definition at line 337 of file types.hpp.

Referenced by build_full(), and xp_bar_scaling().

◆ zoc_

bool unit_type::zoc_
private

Definition at line 368 of file types.hpp.

Referenced by build_full(), and has_zoc().


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