The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
unit Class Reference

#include <unit.hpp>

Classes

struct  upkeep_full
 
struct  upkeep_loyal
 

Public Types

enum  state_t {
  STATE_SLOWED = 0, STATE_POISONED, STATE_PETRIFIED, STATE_UNCOVERED,
  STATE_NOT_MOVED, STATE_UNHEALABLE, STATE_GUARDIAN, STATE_UNKNOWN = -1
}
 
typedef boost::variant
< upkeep_full, upkeep_loyal,
int
t_upkeep
 
typedef boost::ptr_vector< configt_advancements
 

Public Member Functions

 unit (const unit &u)
 
 unit (const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr, n_unit::id_manager *id_manager=nullptr)
 Initializes a unit from a config. More...
 
 unit (const unit_type &t, int side, bool real_unit, unit_race::GENDER gender=unit_race::NUM_GENDERS)
 Initializes a unit from a unit type only real_unit may have random traits, name and gender (to prevent OOS caused by RNG calls) More...
 
virtual ~unit ()
 
void swap (unit &)
 Swap, for copy and swap idiom. More...
 
unitoperator= (unit)
 Assignment operator. More...
 
void advance_to (const unit_type &t, bool use_traits=false)
 Advances this unit to another type. More...
 
const std::vector< std::string > & advances_to () const
 
const std::vector< std::stringadvances_to_translated () const
 
void set_advances_to (const std::vector< std::string > &advances_to)
 
const std::stringtype_id () const
 The id of the type of the unit. More...
 
const unit_typetype () const
 The type of the unit (accounting for gender and variation). More...
 
void set_id (const std::string &id)
 id assigned by wml More...
 
const std::stringid () const
 
size_t underlying_id () const
 The unique internal ID of the unit. More...
 
const t_stringtype_name () const
 The unit type name. More...
 
const std::stringundead_variation () const
 
const std::stringvariation () const
 
const t_stringname () const
 The unit name for display. More...
 
void set_name (const t_string &name)
 
void rename (const std::string &name)
 
std::string small_profile () const
 The unit's profile. More...
 
std::string big_profile () const
 
t_string unit_description () const
 Information about the unit – a detailed description of it. More...
 
int hitpoints () const
 
int max_hitpoints () const
 
void set_hitpoints (int hp)
 
int experience () const
 
int max_experience () const
 
void set_experience (int xp)
 
void set_recall_cost (int recall_cost)
 
int level () const
 
void set_level (int level)
 
int recall_cost () const
 
void remove_movement_ai ()
 
void remove_attacks_ai ()
 
SDL_Color hp_color () const
 Colors for the unit's current hitpoints. More...
 
SDL_Color hp_color (int hitpoints) const
 Colors for the unit's hitpoints. More...
 
SDL_Color xp_color () const
 Colors for the unit's XP. More...
 
double hp_bar_scaling () const
 
double xp_bar_scaling () const
 
bool unrenamable () const
 Set to true for some scenario-specific units which should not be renamed. More...
 
void set_unrenamable (bool unrenamable)
 
int side () const
 
const std::stringteam_color () const
 
unit_race::GENDER gender () const
 
void set_side (unsigned int new_side)
 
fixed_t alpha () const
 
bool can_recruit () const
 
void set_can_recruit (bool canrecruit)
 
const std::vector< std::string > & recruits () const
 
void set_recruits (const std::vector< std::string > &recruits)
 
const configrecall_filter () const
 
bool poisoned () const
 
bool incapacitated () const
 
bool slowed () const
 
int total_movement () const
 
int movement_left () const
 Returns how far a unit can move this turn (zero if incapacitated). More...
 
int movement_left (bool base_value) const
 Providing a true parameter to movement_left() causes it to ignore incapacitation. More...
 
int vision () const
 
int jamming () const
 
void toggle_hold_position ()
 
bool hold_position () const
 
void set_user_end_turn (bool value=true)
 
void toggle_user_end_turn ()
 
bool user_end_turn () const
 
int attacks_left () const
 
int max_attacks () const
 
void set_movement (int moves, bool unit_action=false)
 Set the unit's remaining movement to moves. More...
 
void set_attacks (int left)
 
void new_turn ()
 
void end_turn ()
 
void new_scenario ()
 
bool take_hit (int damage)
 Called on every draw. More...
 
void heal (int amount)
 
void heal_all ()
 
bool resting () const
 
void set_resting (bool rest)
 
const std::map< std::string,
std::string
get_states () const
 
bool get_state (const std::string &state) const
 
void set_state (const std::string &state, bool value)
 
void set_state (state_t state, bool value)
 
bool get_state (state_t state) const
 
bool has_moved () const
 
bool has_goto () const
 
bool emits_zoc () const
 
bool matches_id (const std::string &unit_id) const
 
const std::vector< std::string > & overlays () const
 
void write (config &cfg) const
 
void set_role (const std::string &role)
 
const std::stringget_role () const
 
void set_emit_zoc (bool val)
 
bool get_emit_zoc () const
 
const std::vector< attack_type > & attacks () const
 
std::vector< attack_type > & attacks ()
 
int damage_from (const attack_type &attack, bool attacker, const map_location &loc) const
 
unit_animation_componentanim_comp () const
 
void set_facing (map_location::DIRECTION dir) const
 
map_location::DIRECTION facing () const
 
const std::vector< t_string > & trait_names () const
 
const std::vector< t_string > & trait_descriptions () const
 
std::vector< std::stringget_traits_list () const
 
int cost () const
 
const map_locationget_location () const
 
void set_location (const map_location &loc)
 To be called by unit_map or for temporary units only. More...
 
const map_locationget_goto () const
 
void set_goto (const map_location &new_goto)
 
int upkeep () const
 
t_upkeep upkeep_raw () const
 
void set_upkeep (t_upkeep v)
 
bool loyal () const
 
void set_hidden (bool state) const
 
bool get_hidden () const
 
bool is_flying () const
 
bool is_fearless () const
 
bool is_healthy () const
 
int movement_cost (const t_translation::t_terrain &terrain) const
 
int vision_cost (const t_translation::t_terrain &terrain) const
 
int jamming_cost (const t_translation::t_terrain &terrain) const
 
int defense_modifier (const t_translation::t_terrain &terrain) const
 
int resistance_against (const std::string &damage_name, bool attacker, const map_location &loc) const
 
int resistance_against (const attack_type &damage_type, bool attacker, const map_location &loc) const
 
utils::string_map get_base_resistances () const
 
const movetypemovement_type () const
 
bool can_advance () const
 
bool advances () const
 
std::map< std::string,
std::string
advancement_icons () const
 
std::vector< std::pair
< std::string, std::string > > 
amla_icons () const
 
std::vector< configget_modification_advances () const
 
void set_advancements (std::vector< config > advancements)
 
const t_advancementsmodification_advancements () const
 
size_t modification_count (const std::string &type, const std::string &id) const
 
void add_modification (const std::string &type, const config &modification, bool no_add=false)
 
void expire_modifications (const std::string &duration)
 Clears those modifications whose duration has expired. More...
 
void apply_builtin_effect (std::string type, const config &effect)
 
std::string describe_builtin_effect (std::string type, const config &effect)
 
bool move_interrupted () const
 
const map_locationget_interrupted_move () const
 
void set_interrupted_move (const map_location &interrupted_move)
 
std::string absolute_image () const
 The name of the file to game_display (used in menus). More...
 
std::string default_anim_image () const
 The default image to use for animation frames with no defined image. More...
 
std::string image_halo () const
 
std::string image_ellipse () const
 
std::string usage () const
 
void set_image_halo (const std::string &halo)
 
void set_image_ellipse (const std::string &ellipse)
 
void set_usage (const std::string &usage)
 
configvariables ()
 
const configvariables () const
 
unit_type::ALIGNMENT alignment () const
 
void set_alignment (unit_type::ALIGNMENT alignment)
 
const unit_racerace () const
 Never returns nullptr, but may point to the null race. More...
 
bool get_ability_bool (const std::string &tag_name, const map_location &loc) const
 Returns true if the unit is currently under effect by an ability with this given TAG NAME. More...
 
bool get_ability_bool (const std::string &tag_name) const
 Returns true if the unit is currently under effect by an ability with this given TAG NAME. More...
 
unit_ability_list get_abilities (const std::string &tag_name, const map_location &loc) const
 
unit_ability_list get_abilities (const std::string &tag_name) const
 
std::vector< boost::tuple
< t_string, t_string, t_string > > 
ability_tooltips (std::vector< bool > *active_list=nullptr) const
 Tuple of: neutral ability name, gendered ability name, description. More...
 
std::vector< std::stringget_ability_list () const
 
bool has_ability_type (const std::string &ability) const
 
unit_formula_managerformula_manager () const
 
void backup_state ()
 
void apply_modifications ()
 
void generate_traits (bool musthaveonly=false)
 Apply mandatory traits (e.g. More...
 
void generate_name ()
 
bool invisible (const map_location &loc, bool see_all=true) const
 
bool is_visible_to_team (team const &team, gamemap const &map, bool const see_all=true) const
 
unitclone (bool is_temporary=true)
 Mark this unit as clone so it can be inserted to unit_map. More...
 
std::string TC_image_mods () const
 
const std::stringeffect_image_mods () const
 
std::string image_mods () const
 
long ref_count () const
 
bool has_ability_by_id (const std::string &ability) const
 

Static Public Member Functions

static void clear_status_caches ()
 Clear the unit status cache for all units. More...
 
static const std::stringleader_crown ()
 The path to the leader crown overlay. More...
 
static state_t get_known_boolean_state_id (const std::string &state)
 
static std::map< std::string,
state_t
get_known_boolean_state_names ()
 

Static Public Attributes

static const std::set
< std::string
builtin_effects
 

Protected Attributes

long ref_count_
 
map_location::DIRECTION facing_
 

Private Member Functions

bool ability_active (const std::string &ability, const config &cfg, const map_location &loc) const
 
bool ability_affects_adjacent (const std::string &ability, const config &cfg, int dir, const map_location &loc, const unit &from) const
 
bool ability_affects_self (const std::string &ability, const config &cfg, const map_location &loc) const
 
bool resistance_filter_matches (const config &cfg, bool attacker, const std::string &damage_name, int res) const
 
void remove_ability_by_id (const std::string &ability)
 
void add_trait_description (const config &trait, const t_string &description)
 register a trait's name and its description for UI's use More...
 
void set_underlying_id (n_unit::id_manager &id_manager)
 
void parse_upkeep (const config::attribute_value &upkeep)
 
void write_upkeep (config::attribute_value &upkeep) const
 
void clear_visibility_cache () const
 Clears the cache. More...
 

Private Attributes

map_location loc_
 
std::vector< std::stringadvances_to_
 
const unit_typetype_
 
t_string type_name_
 Never nullptr. Adjusted for gender and variation. More...
 
const unit_racerace_
 The displayed name of the unit type. More...
 
std::string id_
 Never nullptr, but may point to the null race. More...
 
t_string name_
 
n_unit::unit_id underlying_id_
 
std::string undead_variation_
 
std::string variation_
 
int hit_points_
 
int max_hit_points_
 
int experience_
 
int max_experience_
 
int level_
 
int recall_cost_
 
bool canrecruit_
 
std::vector< std::stringrecruit_list_
 
unit_type::ALIGNMENT alignment_
 
std::string flag_rgb_
 
std::string image_mods_
 
bool unrenamable_
 
int side_
 
unit_race::GENDER gender_
 
fixed_t alpha_
 
boost::scoped_ptr
< unit_formula_manager
formula_man_
 
int movement_
 
int max_movement_
 
int vision_
 
int jamming_
 
movetype movement_type_
 
bool hold_position_
 
bool end_turn_
 
bool resting_
 
int attacks_left_
 
int max_attacks_
 
std::set< std::stringstates_
 
std::vector< bool > known_boolean_states_
 
config variables_
 
config events_
 
config filter_recall_
 
bool emit_zoc_
 
std::vector< std::stringoverlays_
 
std::string role_
 
std::vector< attack_typeattacks_
 
std::vector< t_stringtrait_names_
 
std::vector< t_stringtrait_descriptions_
 
int unit_value_
 
map_location goto_
 
map_location interrupted_move_
 
bool is_fearless_
 
bool is_healthy_
 
utils::string_map modification_descriptions_
 
boost::scoped_ptr
< unit_animation_component
anim_comp_
 
bool getsHit_
 
bool hidden_
 
double hp_bar_scaling_
 
double xp_bar_scaling_
 
config modifications_
 
config abilities_
 
t_advancements advancements_
 
t_string description_
 
boost::scoped_ptr< std::stringusage_
 
boost::scoped_ptr< std::stringhalo_
 
boost::scoped_ptr< std::stringellipse_
 
bool random_traits_
 
bool generate_name_
 
t_upkeep upkeep_
 
std::string profile_
 
std::string small_profile_
 
std::map< map_location, bool > invisibility_cache_
 Hold the visibility status cache for a unit, when not uncovered. More...
 

Static Private Attributes

static std::map< std::string,
state_t
known_boolean_state_names_ = get_known_boolean_state_names()
 

Friends

class unit_animation_component
 
void intrusive_ptr_add_ref (const unit *)
 Intrusive Pointer interface. More...
 
void intrusive_ptr_release (const unit *)
 

Detailed Description

Definition at line 95 of file unit.hpp.

Member Typedef Documentation

typedef boost::ptr_vector<config> unit::t_advancements

Definition at line 331 of file unit.hpp.

typedef boost::variant<upkeep_full, upkeep_loyal, int> unit::t_upkeep

Definition at line 297 of file unit.hpp.

Member Enumeration Documentation

Enumerator
STATE_SLOWED 
STATE_POISONED 
STATE_PETRIFIED 
STATE_UNCOVERED 
STATE_NOT_MOVED 
STATE_UNHEALABLE 
STATE_GUARDIAN 
STATE_UNKNOWN 

Definition at line 248 of file unit.hpp.

Constructor & Destructor Documentation

unit::unit ( const unit u)

Definition at line 246 of file unit.cpp.

Referenced by apply_builtin_effect().

unit::unit ( const config cfg,
bool  use_traits = false,
const vconfig vcfg = nullptr,
n_unit::id_manager id_manager = nullptr 
)
explicit
unit::unit ( const unit_type t,
int  side,
bool  real_unit,
unit_race::GENDER  gender = unit_race::NUM_GENDERS 
)

Initializes a unit from a unit type only real_unit may have random traits, name and gender (to prevent OOS caused by RNG calls)

Definition at line 620 of file unit.cpp.

References advance_to(), attacks_left_, resources::gameboard, generate_name(), hit_points_, max_attacks_, max_hit_points_, max_movement_, movement_, set_underlying_id(), and upkeep_.

unit::~unit ( )
virtual

Definition at line 708 of file unit.cpp.

References anim_comp_, e, ERR_UT, gui2::event::find(), and itor.

Member Function Documentation

bool unit::ability_active ( const std::string ability,
const config cfg,
const map_location loc 
) const
private
bool unit::ability_affects_adjacent ( const std::string ability,
const config cfg,
int  dir,
const map_location loc,
const unit from 
) const
private
bool unit::ability_affects_self ( const std::string ability,
const config cfg,
const map_location loc 
) const
private

Definition at line 411 of file abilities.cpp.

References config::child(), resources::filter_con, and unit_filter::matches().

Referenced by get_abilities(), and get_ability_bool().

std::vector< boost::tuple< t_string, t_string, t_string > > unit::ability_tooltips ( std::vector< bool > *  active_list = nullptr) const

Tuple of: neutral ability name, gendered ability name, description.

Returns names and descriptions of the unit's abilities.

The returned triples consist of (in order) base name, male or female name as appropriate for the unit, and description.

Parameters
active_listIf nullptr, then all abilities are forced active. If not null, this vector will be the same length as the returned one and will indicate whether or not the corresponding ability is active.

Definition at line 261 of file abilities.cpp.

References abilities_, ability_active(), config::all_children_range(), config::attribute_value::blank(), t_string::empty(), gender_, loc_, name(), and config::attribute_value::t_str().

Referenced by dialogs::units_list_preview_pane::get_details(), and unit_abilities().

std::string unit::absolute_image ( ) const
void unit::add_modification ( const std::string type,
const config modification,
bool  no_add = false 
)
void unit::add_trait_description ( const config trait,
const t_string description 
)
private

register a trait's name and its description for UI's use

Definition at line 2249 of file unit.cpp.

References t_string::empty(), unit_race::FEMALE, gender_, gender_string(), trait_descriptions_, and trait_names_.

Referenced by add_modification().

void unit::advance_to ( const unit_type u_type,
bool  use_traits = false 
)

Advances this unit to another type.

Advances this unit to the specified type.

Experience is left unchanged. Current hit point total is left unchanged unless it would violate max HP. Assumes gender_ and variation_ are set to their correct values.

Definition at line 904 of file unit.cpp.

References abilities_, unit_type::abilities_cfg(), game_events::manager::add_events(), unit_type::advancements(), advancements_, unit_type::advances_to(), advances_to_, alignment_, unit_type::alpha(), alpha_, anim_comp_, apply_modifications(), unit_type::attacks(), attacks_, unit_type::big_profile(), unit_type::cost(), description_, unit_type::ellipse(), emit_zoc_, unit_type::events(), unit_type::experience_needed(), unit_type::flag_rgb(), flag_rgb_, resources::game_events, gender_, unit_type::generate_name(), generate_name_, generate_traits(), unit_type::get_cfg_for_units(), unit_type::get_gender_unit_type(), get_state(), unit_type::get_variation(), unit_type::halo(), unit_type::has_zoc(), hit_points_, unit_type::hitpoints(), unit_type::hp_bar_scaling(), hp_bar_scaling_, unit_type::id(), is_fearless_, is_healthy_, unit_type::jamming(), jamming_, unit_type::level(), level_, unit_type::max_attacks(), max_attacks_, max_experience_, max_hit_points_, max_movement_, modification_descriptions_, unit_type::movement(), unit_type::movement_type(), movement_type_, profile_, unit_type::race(), race_, random_traits_, unit_type::recall_cost(), recall_cost_, set_image_ellipse(), set_image_halo(), set_state(), set_usage(), unit_type::small_profile(), small_profile_, STATE_POISONED, trait_descriptions_, trait_names_, type(), type_, unit_type::type_name(), type_name_, unit_type::undead_variation(), undead_variation_, unit_type::unit_description(), unit_value_, unit_type::usage(), variation_, unit_type::vision(), vision_, unit_type::xp_bar_scaling(), and xp_bar_scaling_.

Referenced by apply_builtin_effect(), expire_modifications(), ai::helper_advance_unit(), intf_transform_unit(), and unit().

std::map< std::string, std::string > unit::advancement_icons ( ) const
bool unit::advances ( ) const
inline

Definition at line 324 of file unit.hpp.

References can_advance(), experience_, and max_experience().

const std::vector<std::string>& unit::advances_to ( ) const
inline
const std::vector< std::string > unit::advances_to_translated ( ) const
unit_type::ALIGNMENT unit::alignment ( ) const
inline
fixed_t unit::alpha ( ) const
inline

Definition at line 205 of file unit.hpp.

References alpha_.

std::vector< std::pair< std::string, std::string > > unit::amla_icons ( ) const

Definition at line 1611 of file unit.cpp.

References get_modification_advances(), and modification_count().

Referenced by REPORT_GENERATOR().

unit_animation_component& unit::anim_comp ( ) const
inline
void unit::apply_builtin_effect ( std::string  type,
const config effect 
)
void unit::apply_modifications ( )
const std::vector<attack_type>& unit::attacks ( ) const
inline
std::vector<attack_type>& unit::attacks ( )
inline

Definition at line 272 of file unit.hpp.

References attacks_.

int unit::attacks_left ( ) const
inline
void unit::backup_state ( )
std::string unit::big_profile ( ) const

Definition at line 1012 of file unit.cpp.

References absolute_image(), and profile_.

Referenced by impl_unit_get().

bool unit::can_advance ( ) const
inline
bool unit::can_recruit ( ) const
inline
void unit::clear_status_caches ( )
static

Clear the unit status cache for all units.

Currently only the hidden status of units is cached this way.

Definition at line 610 of file unit.cpp.

References itor.

Referenced by game_lua_kernel::intf_teleport(), game_events::t_pump::operator()(), editor::editor_action_unit_replace::perform_without_undo(), actions::undo::move_action::redo(), and actions::undo::move_action::undo().

void unit::clear_visibility_cache ( ) const
inlineprivate

Clears the cache.

Since we don't change the state of the object we're marked const (also required since the objects in the cache need to be marked const).

Definition at line 550 of file unit.hpp.

unit & unit::clone ( bool  is_temporary = true)
int unit::cost ( ) const
inline
int unit::damage_from ( const attack_type attack,
bool  attacker,
const map_location loc 
) const
inline
std::string unit::default_anim_image ( ) const

The default image to use for animation frames with no defined image.

Definition at line 2267 of file unit.cpp.

References unit_type::icon(), unit_type::image(), and type().

Referenced by unit_animation_component::invalidate(), and unit_drawer::redraw_unit().

int unit::defense_modifier ( const t_translation::t_terrain terrain) const
std::string unit::describe_builtin_effect ( std::string  type,
const config effect 
)
const std::string & unit::effect_image_mods ( ) const

Definition at line 2439 of file unit.cpp.

References image_mods_.

Referenced by impl_unit_get().

bool unit::emits_zoc ( ) const
inline

Definition at line 257 of file unit.hpp.

References emit_zoc_, and incapacitated().

Referenced by pathfind::enemy_zoc(), and unit_drawer::redraw_unit().

void unit::end_turn ( )
int unit::experience ( ) const
inline
void unit::expire_modifications ( const std::string duration)

Clears those modifications whose duration has expired.

If duration is empty, then all temporary modifications (those not lasting forever) have expired. Otherwise, modifications whose duration equals duration have expired.

Definition at line 1180 of file unit.cpp.

References advance_to(), anim_comp_, config::child(), config::child_count(), config::get(), get_unit_type(), i, mod_duration_match(), modifications_, config::remove_child(), and type().

Referenced by end_turn(), new_scenario(), and new_turn().

map_location::DIRECTION unit::facing ( ) const
inline
unit_formula_manager& unit::formula_manager ( ) const
inline

Definition at line 393 of file unit.hpp.

References formula_man_.

Referenced by unit_callable::get_value().

unit_race::GENDER unit::gender ( ) const
inline
void unit::generate_name ( )

Definition at line 804 of file unit.cpp.

References t_string::empty(), gender_, unit_race::generate_name(), generate_name_, name_, and race_.

Referenced by unit().

void unit::generate_traits ( bool  musthaveonly = false)

Apply mandatory traits (e.g.

undead, mechanical) to a unit and then fill out with available (leaders have a restricted set of available traits) traits until no more are available or the unit has its maximum number of traits. This routine does not apply the effects of added traits to a unit. That must be done by the caller. Note that random numbers used in config files don't work in multiplayer, so that leaders should be barred from all random traits until that is fixed. Later the restrictions will be based on play balance. musthaveonly is true when you don't want to generate random traits or you don't want to give any optional traits to a unit.

Definition at line 827 of file unit.cpp.

References config::add_child(), can_recruit(), config::child_range(), random_new::generator, random_new::rng::get_random_int(), unit_type::log_id(), LOG_UT, modifications_, unit_type::num_traits(), unit_type::possible_traits(), random_traits_, and type().

Referenced by advance_to().

unit_ability_list unit::get_abilities ( const std::string tag_name,
const map_location loc 
) const
unit_ability_list unit::get_abilities ( const std::string tag_name) const
inline

Definition at line 386 of file unit.hpp.

References get_abilities(), and loc_.

bool unit::get_ability_bool ( const std::string tag_name,
const map_location loc 
) const
bool unit::get_ability_bool ( const std::string tag_name) const
inline

Returns true if the unit is currently under effect by an ability with this given TAG NAME.

This means that the ability could be owned by the unit itself, or by an adjacent unit.

Definition at line 383 of file unit.hpp.

References get_ability_bool(), and loc_.

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

Definition at line 210 of file abilities.cpp.

References abilities_, and config::all_children_range().

Referenced by unit_callable::get_value(), and impl_unit_get().

utils::string_map unit::get_base_resistances ( ) const
inline

Definition at line 320 of file unit.hpp.

References movetype::damage_table(), and movement_type_.

Referenced by unit_hp().

bool unit::get_emit_zoc ( ) const
inline

Definition at line 268 of file unit.hpp.

References emit_zoc_.

Referenced by unit_callable::get_value(), and impl_unit_get().

const map_location& unit::get_goto ( ) const
inline

Definition at line 290 of file unit.hpp.

References goto_.

Referenced by has_goto().

bool unit::get_hidden ( ) const
inline

Definition at line 304 of file unit.hpp.

References hidden_.

Referenced by unit_callable::get_value(), impl_unit_get(), and unit_drawer::redraw_unit().

const map_location& unit::get_interrupted_move ( ) const
inline

Definition at line 347 of file unit.hpp.

References interrupted_move_.

unit::state_t unit::get_known_boolean_state_id ( const std::string state)
static

Definition at line 1314 of file unit.cpp.

References i, known_boolean_state_names_, and STATE_UNKNOWN.

Referenced by get_state(), and set_state().

std::map< std::string, unit::state_t > unit::get_known_boolean_state_names ( )
static
const map_location& unit::get_location ( ) const
inline
std::vector< config > unit::get_modification_advances ( ) const
const std::string& unit::get_role ( ) const
inline
bool unit::get_state ( const std::string state) const
bool unit::get_state ( state_t  state) const

Definition at line 1309 of file unit.cpp.

References known_boolean_states_.

const std::map< std::string, std::string > unit::get_states ( ) const
std::vector< std::string > unit::get_traits_list ( ) const

Definition at line 883 of file unit.cpp.

References config::child_range(), and modifications_.

Referenced by unit_callable::get_value(), impl_unit_get(), and unit_traits().

bool unit::has_ability_by_id ( const std::string ability) const
bool unit::has_ability_type ( const std::string ability) const

Definition at line 419 of file abilities.cpp.

References abilities_, and config::child_range().

bool unit::has_goto ( ) const
inline

Definition at line 256 of file unit.hpp.

References get_goto(), and map_location::valid().

Referenced by display_context::unit_can_move().

bool unit::has_moved ( ) const
inline

Definition at line 255 of file unit.hpp.

References movement_left(), and total_movement().

Referenced by display_context::unit_can_move().

void unit::heal ( int  amount)

Definition at line 1253 of file unit.cpp.

References amount, hit_points_, and max_hitpoints().

void unit::heal_all ( )
inline
int unit::hitpoints ( ) const
inline
bool unit::hold_position ( ) const
inline

Definition at line 226 of file unit.hpp.

References hold_position_.

double unit::hp_bar_scaling ( ) const
inline

Definition at line 195 of file unit.hpp.

References hp_bar_scaling_.

Referenced by unit_drawer::redraw_unit().

SDL_Color unit::hp_color ( ) const

Colors for the unit's current hitpoints.

Returns
a color between green and red representing how wounded the unit is. The maximum_hitpoints are considered as base.

Definition at line 1065 of file unit.cpp.

References hitpoints(), hp_color_(), and max_hitpoints().

Referenced by gui2::format_stats(), dialogs::units_list_preview_pane::get_details(), unit_drawer::redraw_unit(), unit_hp(), and unit_weapons().

SDL_Color unit::hp_color ( int  hitpoints) const

Colors for the unit's hitpoints.

Parameters
hitpointsthe amount of hitpoints the color represents.
Returns
the color considering the current hitpoints as base.

Definition at line 1070 of file unit.cpp.

References hitpoints(), and hp_color_().

const std::string& unit::id ( ) const
inline
std::string unit::image_ellipse ( ) const
inline

Definition at line 358 of file unit.hpp.

References ellipse_, and unit_detail::get_or_default().

Referenced by unit_drawer::redraw_unit().

std::string unit::image_halo ( ) const
inline

Definition at line 356 of file unit.hpp.

References unit_detail::get_or_default(), and halo_.

Referenced by unit_drawer::redraw_unit().

std::string unit::image_mods ( ) const
bool unit::incapacitated ( ) const
inline
bool unit::invisible ( const map_location loc,
bool  see_all = true 
) const
Todo:
FIXME: We use the cache only when using the default see_all=true Maybe add a second cache if the see_all=false become more frequent.

Definition at line 2291 of file unit.cpp.

References DBG_UT, resources::gameboard, get_ability_bool(), get_location(), get_state(), id(), invisibility_cache_, itor, side_, STATE_UNCOVERED, and display_context::would_be_discovered().

Referenced by basic_unit_filter_impl::internal_matches_filter(), is_visible_to_team(), pathfind::mark_route(), unit_drawer::redraw_unit(), unit_status(), and display_context::would_be_discovered().

bool unit::is_fearless ( ) const
inline
bool unit::is_flying ( ) const
inline
bool unit::is_healthy ( ) const
inline

Definition at line 307 of file unit.hpp.

References is_healthy_.

Referenced by calculate_healing().

bool unit::is_visible_to_team ( team const &  team,
gamemap const &  map,
bool const  see_all = true 
) const
int unit::jamming ( ) const
inline

Definition at line 224 of file unit.hpp.

References jamming_.

Referenced by pathfind::jamming_path::jamming_path().

int unit::jamming_cost ( const t_translation::t_terrain terrain) const
inline

Definition at line 312 of file unit.hpp.

References get_state(), movetype::jamming_cost(), movement_type_, and STATE_SLOWED.

Referenced by intf_unit_jamming_cost().

const std::string & unit::leader_crown ( )
static

The path to the leader crown overlay.

Definition at line 234 of file unit.cpp.

Referenced by dialogs::units_list_preview_pane::get_details(), gui2::get_image_mods(), dialogs::recall_dialog(), and unit_drawer::redraw_unit().

int unit::level ( ) const
inline
bool unit::loyal ( ) const

Definition at line 1515 of file unit.cpp.

References upkeep_.

bool unit::matches_id ( const std::string unit_id) const

Definition at line 2417 of file unit.cpp.

References id_.

int unit::max_attacks ( ) const
inline

Definition at line 231 of file unit.hpp.

References max_attacks_.

Referenced by unit_callable::get_value(), and impl_unit_get().

int unit::max_experience ( ) const
inline
int unit::max_hitpoints ( ) const
inline
const t_advancements& unit::modification_advancements ( ) const
inline

Definition at line 333 of file unit.hpp.

References advancements_.

Referenced by get_modification_advances(), and impl_unit_get().

size_t unit::modification_count ( const std::string type,
const std::string id 
) const

Definition at line 1695 of file unit.cpp.

References config::child_range(), and modifications_.

Referenced by amla_icons(), and get_modification_advances().

bool unit::move_interrupted ( ) const
inline

Definition at line 346 of file unit.hpp.

References interrupted_move_, movement_left(), map_location::x, and map_location::y.

int unit::movement_cost ( const t_translation::t_terrain terrain) const
inline
int unit::movement_left ( ) const
inline
int unit::movement_left ( bool  base_value) const
inline

Providing a true parameter to movement_left() causes it to ignore incapacitation.

Definition at line 222 of file unit.hpp.

References movement_, and movement_left().

Referenced by movement_left().

const movetype& unit::movement_type ( ) const
inline
const t_string& unit::name ( ) const
inline
void unit::new_scenario ( )
void unit::new_turn ( )
unit & unit::operator= ( unit  other)

Assignment operator.

Definition at line 797 of file unit.cpp.

References swap().

const std::vector<std::string>& unit::overlays ( ) const
inline
void unit::parse_upkeep ( const config::attribute_value upkeep)
private

Definition at line 2475 of file unit.cpp.

References config::attribute_value::empty(), config::attribute_value::to_int(), upkeep_, and WRN_UT.

Referenced by unit().

bool unit::poisoned ( ) const
inline

Definition at line 214 of file unit.hpp.

References get_state(), and STATE_POISONED.

Referenced by unit_drawer::redraw_unit().

const unit_race* unit::race ( ) const
inline

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

Definition at line 371 of file unit.hpp.

References race_.

Referenced by dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), impl_unit_get(), basic_unit_filter_impl::internal_matches_filter(), and unit_race().

int unit::recall_cost ( ) const
inline
const config& unit::recall_filter ( ) const
inline

Definition at line 212 of file unit.hpp.

References filter_recall_.

const std::vector<std::string>& unit::recruits ( ) const
inline

Definition at line 209 of file unit.hpp.

References recruit_list_.

Referenced by unit_callable::get_value(), impl_unit_get(), and set_recruits().

long unit::ref_count ( ) const
inline

Definition at line 414 of file unit.hpp.

References ref_count_.

Referenced by intrusive_ptr_add_ref(), and intrusive_ptr_release().

void unit::remove_ability_by_id ( const std::string ability)
private

Definition at line 1367 of file unit.cpp.

References abilities_, config::erase(), i, config::ordered_begin(), and config::ordered_end().

Referenced by apply_builtin_effect().

void unit::remove_attacks_ai ( )

Definition at line 2443 of file unit.cpp.

References attacks_left_, max_attacks_, and set_attacks().

void unit::remove_movement_ai ( )

Definition at line 2451 of file unit.cpp.

References movement_left(), set_movement(), set_state(), STATE_NOT_MOVED, and total_movement().

void unit::rename ( const std::string name)
inline

Definition at line 160 of file unit.hpp.

References name(), name_, and unrenamable_.

int unit::resistance_against ( const std::string damage_name,
bool  attacker,
const map_location loc 
) const
int unit::resistance_against ( const attack_type damage_type,
bool  attacker,
const map_location loc 
) const
inline

Definition at line 316 of file unit.hpp.

References resistance_against(), and attack_type::type().

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

Definition at line 1535 of file unit.cpp.

References unit_abilities::filter_base_matches(), gui2::event::find(), and utils::split().

Referenced by resistance_against().

bool unit::resting ( ) const
inline

Definition at line 242 of file unit.hpp.

References resting_.

Referenced by calculate_healing(), unit_callable::get_value(), and impl_unit_get().

void unit::set_advancements ( std::vector< config advancements)

Definition at line 1685 of file unit.cpp.

References advancements_.

Referenced by impl_unit_set().

void unit::set_advances_to ( const std::vector< std::string > &  advances_to)

Definition at line 1136 of file unit.cpp.

References advances_to(), advances_to_, unit_type_data::check_types(), and unit_types.

Referenced by impl_unit_set().

void unit::set_alignment ( unit_type::ALIGNMENT  alignment)
inline

Definition at line 369 of file unit.hpp.

References alignment(), and alignment_.

Referenced by impl_unit_set().

void unit::set_attacks ( int  left)
inline
void unit::set_can_recruit ( bool  canrecruit)
inline

Definition at line 208 of file unit.hpp.

References canrecruit_.

Referenced by impl_unit_set().

void unit::set_emit_zoc ( bool  val)
inline

Definition at line 267 of file unit.hpp.

References emit_zoc_.

Referenced by impl_unit_set().

void unit::set_experience ( int  xp)
inline

Definition at line 173 of file unit.hpp.

References experience_.

Referenced by ai::helper_advance_unit(), and impl_unit_set().

void unit::set_facing ( map_location::DIRECTION  dir) const
void unit::set_goto ( const map_location new_goto)
inline

Definition at line 291 of file unit.hpp.

References goto_.

void unit::set_hidden ( bool  state) const
void unit::set_hitpoints ( int  hp)
inline

Definition at line 170 of file unit.hpp.

References hit_points_.

Referenced by impl_unit_set().

void unit::set_id ( const std::string id)
inline

id assigned by wml

Definition at line 147 of file unit.hpp.

References id(), and id_.

void unit::set_image_ellipse ( const std::string ellipse)
inline

Definition at line 363 of file unit.hpp.

References ellipse_.

Referenced by advance_to(), apply_builtin_effect(), and unit().

void unit::set_image_halo ( const std::string halo)

Definition at line 2467 of file unit.cpp.

References anim_comp_, and halo_.

Referenced by advance_to(), apply_builtin_effect(), and unit().

void unit::set_interrupted_move ( const map_location interrupted_move)
inline

Definition at line 348 of file unit.hpp.

References interrupted_move_.

Referenced by end_turn().

void unit::set_level ( int  level)
inline

Definition at line 176 of file unit.hpp.

References level(), and level_.

Referenced by impl_unit_set().

void unit::set_location ( const map_location loc)
inline

To be called by unit_map or for temporary units only.

Definition at line 288 of file unit.hpp.

References loc_.

Referenced by pathfind::full_cost_map::add_unit(), impl_unit_set(), and teleport_unit_between().

void unit::set_movement ( int  moves,
bool  unit_action = false 
)

Set the unit's remaining movement to moves.

If unit_action is set to true, then additionally the "end turn" and "hold position" flags will be cleared (as they should be if a unit acts, as opposed to the movement being set by the engine for other reasons).

Definition at line 1148 of file unit.cpp.

References end_turn_, hold_position_, and movement_.

Referenced by wb::attack::apply_temp_modifier(), ai::helper_place_unit(), impl_unit_set(), remove_movement_ai(), wb::attack::remove_temp_modifier(), unit_movement_resetter::unit_movement_resetter(), and unit_movement_resetter::~unit_movement_resetter().

void unit::set_name ( const t_string name)
inline

Definition at line 159 of file unit.hpp.

References name(), and name_.

Referenced by impl_unit_set().

void unit::set_recall_cost ( int  recall_cost)
inline

Definition at line 174 of file unit.hpp.

References recall_cost(), and recall_cost_.

Referenced by impl_unit_set().

void unit::set_recruits ( const std::vector< std::string > &  recruits)

Definition at line 1112 of file unit.cpp.

References unit_type_data::check_types(), recruit_list_, recruits(), and unit_types.

Referenced by impl_unit_set(), and unit().

void unit::set_resting ( bool  rest)
inline

Definition at line 243 of file unit.hpp.

References resting_.

Referenced by calculate_healing(), and impl_unit_set().

void unit::set_role ( const std::string role)
inline

Definition at line 264 of file unit.hpp.

References role_.

Referenced by impl_unit_set().

void unit::set_side ( unsigned int  new_side)
inline

Definition at line 204 of file unit.hpp.

References side_.

Referenced by impl_unit_set().

void unit::set_state ( const std::string state,
bool  value 
)
void unit::set_state ( state_t  state,
bool  value 
)

Definition at line 1304 of file unit.cpp.

References known_boolean_states_.

void unit::set_underlying_id ( n_unit::id_manager id_manager)
private
void unit::set_unrenamable ( bool  unrenamable)
inline

Definition at line 200 of file unit.hpp.

References unrenamable(), and unrenamable_.

void unit::set_upkeep ( t_upkeep  v)
inline

Definition at line 300 of file unit.hpp.

References upkeep_.

Referenced by impl_unit_set().

void unit::set_usage ( const std::string usage)
inline

Definition at line 364 of file unit.hpp.

References usage_.

Referenced by advance_to(), and unit().

void unit::set_user_end_turn ( bool  value = true)
inline

Definition at line 227 of file unit.hpp.

References end_turn_.

int unit::side ( ) const
inline

Definition at line 201 of file unit.hpp.

References side_.

Referenced by actions::actor_sighted(), pathfind::full_cost_map::add_unit(), attack_info(), calculate_healing(), game_state::can_recruit_from(), game_state::can_recruit_on(), can_see(), actions::shroud_clearer::clear_dest(), actions::shroud_clearer::clear_unit(), pathfind::shortest_path_calculator::cost(), wb::manager::create_temp_move(), ai::default_recruitment::recruitment::do_combat_analysis(), game_display::draw_hex(), pathfind::enemy_zoc(), ai::ai_default_rca::get_healing_phase::evaluate(), wb::find_actions_of(), pathfind::find_routes(), pathfind::find_vacant_castle(), wb::future_visible_unit(), get_abilities(), get_ability_bool(), ai::default_recruitment::recruitment::get_cost_map_of_side(), gui2::get_image_mods(), ai::move_result::get_unit(), ai::stopunit_result::get_unit(), ai::default_recruitment::recruitment::get_unit_ratio(), unit_callable::get_value(), impl_unit_get(), basic_unit_filter_impl::internal_matches_filter(), game_lua_kernel::intf_find_path(), game_lua_kernel::intf_find_reach(), is_visible_to_team(), luaW_pushfaivariant(), pathfind::mark_route(), wb::path_cost(), pathfind::paths::paths(), unit_creator::post_create(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), unit_drawer::redraw_unit(), events::mouse_handler::show_attack_options(), SYNCED_COMMAND_HANDLER_FUNCTION(), TC_image_mods(), pathfind::teleport_map::teleport_map(), display_context::unit_can_move(), unit_moves(), unit_side(), ai::default_recruitment::recruitment::update_important_hexes(), ai::default_recruitment::recruitment::update_own_units_count(), and display_context::would_be_discovered().

bool unit::slowed ( ) const
inline

Definition at line 216 of file unit.hpp.

References get_state(), and STATE_SLOWED.

Referenced by unit_drawer::redraw_unit().

std::string unit::small_profile ( ) const

The unit's profile.

Definition at line 1020 of file unit.cpp.

References absolute_image(), and small_profile_.

Referenced by REPORT_GENERATOR().

void unit::swap ( unit o)
bool unit::take_hit ( int  damage)
inline

Called on every draw.

Definition at line 239 of file unit.hpp.

References hit_points_.

std::string unit::TC_image_mods ( ) const
const std::string& unit::team_color ( ) const
inline

Definition at line 202 of file unit.hpp.

References flag_rgb_.

Referenced by gui2::get_image_mods(), and dialogs::recall_dialog().

void unit::toggle_hold_position ( )
inline

Definition at line 225 of file unit.hpp.

References end_turn_, and hold_position_.

void unit::toggle_user_end_turn ( )
inline

Definition at line 228 of file unit.hpp.

References end_turn_, and hold_position_.

int unit::total_movement ( ) const
inline
const std::vector<t_string>& unit::trait_descriptions ( ) const
inline

Definition at line 281 of file unit.hpp.

References trait_descriptions_.

Referenced by unit_traits().

const std::vector<t_string>& unit::trait_names ( ) const
inline
const unit_type& unit::type ( ) const
inline
const std::string& unit::type_id ( ) const
inline
const t_string& unit::type_name ( ) const
inline
const std::string& unit::undead_variation ( ) const
inline

Definition at line 154 of file unit.hpp.

References undead_variation_.

Referenced by battle_context_unit_stats::battle_context_unit_stats().

size_t unit::underlying_id ( ) const
inline
t_string unit::unit_description ( ) const
inline

Information about the unit – a detailed description of it.

Definition at line 166 of file unit.hpp.

References description_.

Referenced by unit_type(), and write().

bool unit::unrenamable ( ) const
inline

Set to true for some scenario-specific units which should not be renamed.

Definition at line 199 of file unit.hpp.

References unrenamable_.

Referenced by set_unrenamable().

int unit::upkeep ( ) const

Definition at line 1498 of file unit.cpp.

References can_recruit(), level(), and upkeep_.

Referenced by unit_callable::get_value().

t_upkeep unit::upkeep_raw ( ) const
inline

Definition at line 299 of file unit.hpp.

References upkeep_.

Referenced by impl_unit_get().

std::string unit::usage ( ) const
inline

Definition at line 360 of file unit.hpp.

References unit_detail::get_or_default(), and usage_.

Referenced by unit_callable::get_value(), and impl_unit_get().

bool unit::user_end_turn ( ) const
inline

Definition at line 229 of file unit.hpp.

References end_turn_.

Referenced by unit_drawer::redraw_unit().

config& unit::variables ( )
inline
const config& unit::variables ( ) const
inline

Definition at line 367 of file unit.hpp.

References variables_.

const std::string& unit::variation ( ) const
inline
int unit::vision ( ) const
inline
int unit::vision_cost ( const t_translation::t_terrain terrain) const
inline

Definition at line 310 of file unit.hpp.

References get_state(), movement_type_, STATE_SLOWED, and movetype::vision_cost().

Referenced by intf_unit_vision_cost().

void unit::write ( config cfg) const
void unit::write_upkeep ( config::attribute_value upkeep) const
private

Definition at line 2496 of file unit.cpp.

References upkeep_.

Referenced by write().

double unit::xp_bar_scaling ( ) const
inline

Definition at line 196 of file unit.hpp.

References xp_bar_scaling_.

Referenced by unit_drawer::redraw_unit().

SDL_Color unit::xp_color ( ) const

Friends And Related Function Documentation

void intrusive_ptr_add_ref ( const unit u)
friend

Intrusive Pointer interface.

Definition at line 164 of file unit.cpp.

void intrusive_ptr_release ( const unit u)
friend

Definition at line 180 of file unit.cpp.

friend class unit_animation_component
friend

Definition at line 514 of file unit.hpp.

Member Data Documentation

config unit::abilities_
private
t_advancements unit::advancements_
private
std::vector<std::string> unit::advances_to_
private
unit_type::ALIGNMENT unit::alignment_
private

Definition at line 462 of file unit.hpp.

Referenced by advance_to(), alignment(), apply_builtin_effect(), set_alignment(), swap(), unit(), and write().

fixed_t unit::alpha_
private

Definition at line 472 of file unit.hpp.

Referenced by advance_to(), alpha(), swap(), unit(), and write().

boost::scoped_ptr<unit_animation_component> unit::anim_comp_
private
std::vector<attack_type> unit::attacks_
private
int unit::attacks_left_
private

Definition at line 484 of file unit.hpp.

Referenced by attacks_left(), new_turn(), remove_attacks_ai(), set_attacks(), swap(), unit(), and write().

const std::set< std::string > unit::builtin_effects
static
Initial value:
= {
"alignment", "attack", "defense", "ellipse", "experience", "fearless",
"halo", "healthy", "hitpoints", "image_mod", "jamming", "jamming_costs",
"loyal", "max_attacks", "max_experience", "movement", "movement_costs",
"new_ability", "new_advancement", "new_animation", "new_attack", "overlay", "profile",
"recall_cost", "remove_ability", "remove_advancement", "remove_attacks", "resistance",
"status", "type", "variation", "vision", "vision_costs", "zoc"}

Definition at line 342 of file unit.hpp.

Referenced by add_modification(), and game_lua_kernel::game_lua_kernel().

bool unit::canrecruit_
private

Definition at line 460 of file unit.hpp.

Referenced by can_recruit(), set_can_recruit(), and swap().

t_string unit::description_
private

Definition at line 526 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), unit(), unit_description(), and write().

boost::scoped_ptr<std::string> unit::ellipse_
private

Definition at line 529 of file unit.hpp.

Referenced by image_ellipse(), set_image_ellipse(), and write().

bool unit::emit_zoc_
private
bool unit::end_turn_
private
config unit::events_
private

Definition at line 491 of file unit.hpp.

Referenced by swap(), unit(), and write().

int unit::experience_
private

Definition at line 454 of file unit.hpp.

Referenced by advances(), apply_builtin_effect(), experience(), set_experience(), swap(), unit(), and write().

map_location::DIRECTION unit::facing_
mutableprotected
config unit::filter_recall_
private

Definition at line 492 of file unit.hpp.

Referenced by recall_filter(), swap(), unit(), and write().

std::string unit::flag_rgb_
private

Definition at line 463 of file unit.hpp.

Referenced by advance_to(), swap(), TC_image_mods(), team_color(), and write().

boost::scoped_ptr<unit_formula_manager> unit::formula_man_
private

Definition at line 474 of file unit.hpp.

Referenced by formula_manager(), swap(), unit(), and write().

unit_race::GENDER unit::gender_
private
bool unit::generate_name_
private

Definition at line 531 of file unit.hpp.

Referenced by advance_to(), generate_name(), unit(), and write().

bool unit::getsHit_
private

Definition at line 519 of file unit.hpp.

Referenced by swap().

map_location unit::goto_
private

Definition at line 508 of file unit.hpp.

Referenced by get_goto(), new_scenario(), set_goto(), swap(), unit(), and write().

boost::scoped_ptr<std::string> unit::halo_
private

Definition at line 528 of file unit.hpp.

Referenced by image_halo(), set_image_halo(), and write().

bool unit::hidden_
mutableprivate

Definition at line 520 of file unit.hpp.

Referenced by get_hidden(), set_hidden(), and swap().

int unit::hit_points_
private
bool unit::hold_position_
private
double unit::hp_bar_scaling_
private

Definition at line 521 of file unit.hpp.

Referenced by advance_to(), and hp_bar_scaling().

std::string unit::id_
private

Never nullptr, but may point to the null race.

Definition at line 446 of file unit.hpp.

Referenced by clone(), id(), matches_id(), set_id(), set_underlying_id(), swap(), and write().

std::string unit::image_mods_
private

Definition at line 464 of file unit.hpp.

Referenced by apply_builtin_effect(), effect_image_mods(), image_mods(), and swap().

map_location unit::interrupted_move_
private

Definition at line 508 of file unit.hpp.

Referenced by get_interrupted_move(), move_interrupted(), set_interrupted_move(), and swap().

std::map<map_location, bool> unit::invisibility_cache_
mutableprivate

Hold the visibility status cache for a unit, when not uncovered.

This is mutable since it is a cache.

Definition at line 542 of file unit.hpp.

Referenced by invisible(), and swap().

bool unit::is_fearless_
private

Definition at line 510 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), is_fearless(), and swap().

bool unit::is_healthy_
private

Definition at line 510 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), is_healthy(), and swap().

int unit::jamming_
private

Definition at line 479 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), jamming(), swap(), and write().

std::map< std::string, unit::state_t > unit::known_boolean_state_names_ = get_known_boolean_state_names()
staticprivate

Definition at line 489 of file unit.hpp.

Referenced by get_known_boolean_state_id(), and get_states().

std::vector<bool> unit::known_boolean_states_
private

Definition at line 488 of file unit.hpp.

Referenced by get_state(), set_state(), and swap().

int unit::level_
private

Definition at line 457 of file unit.hpp.

Referenced by add_modification(), advance_to(), level(), set_level(), swap(), unit(), and write().

map_location unit::loc_
private
int unit::max_attacks_
private
int unit::max_experience_
private
int unit::max_hit_points_
private

Definition at line 453 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), max_hitpoints(), swap(), unit(), and write().

int unit::max_movement_
private

Definition at line 477 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), swap(), total_movement(), unit(), vision(), and write().

utils::string_map unit::modification_descriptions_
private

Definition at line 512 of file unit.hpp.

Referenced by advance_to(), and swap().

config unit::modifications_
private
int unit::movement_
private
movetype unit::movement_type_
private
t_string unit::name_
private

Definition at line 447 of file unit.hpp.

Referenced by generate_name(), name(), rename(), set_name(), swap(), and write().

std::vector<std::string> unit::overlays_
private

Definition at line 496 of file unit.hpp.

Referenced by apply_builtin_effect(), overlays(), swap(), unit(), and write().

std::string unit::profile_
private

Definition at line 533 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), big_profile(), unit(), and write().

const unit_race* unit::race_
private

The displayed name of the unit type.

Definition at line 445 of file unit.hpp.

Referenced by advance_to(), generate_name(), race(), swap(), unit(), and write().

bool unit::random_traits_
private

Definition at line 530 of file unit.hpp.

Referenced by advance_to(), generate_traits(), unit(), and write().

int unit::recall_cost_
private

Definition at line 459 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), recall_cost(), set_recall_cost(), swap(), unit(), and write().

std::vector<std::string> unit::recruit_list_
private

Definition at line 461 of file unit.hpp.

Referenced by recruits(), set_recruits(), swap(), and write().

long unit::ref_count_
mutableprotected

Definition at line 418 of file unit.hpp.

Referenced by intrusive_ptr_add_ref(), intrusive_ptr_release(), and ref_count().

bool unit::resting_
private

Definition at line 483 of file unit.hpp.

Referenced by end_turn(), resting(), set_resting(), swap(), unit(), and write().

std::string unit::role_
private

Definition at line 498 of file unit.hpp.

Referenced by get_role(), set_role(), swap(), and write().

int unit::side_
private

Definition at line 468 of file unit.hpp.

Referenced by ability_active(), apply_builtin_effect(), invisible(), set_side(), side(), swap(), unit(), and write().

std::string unit::small_profile_
private

Definition at line 534 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), small_profile(), unit(), and write().

std::set<std::string> unit::states_
private

Definition at line 487 of file unit.hpp.

Referenced by get_state(), get_states(), set_state(), and swap().

std::vector<t_string> unit::trait_descriptions_
private

Definition at line 505 of file unit.hpp.

Referenced by add_trait_description(), advance_to(), swap(), and trait_descriptions().

std::vector<t_string> unit::trait_names_
private

Definition at line 504 of file unit.hpp.

Referenced by add_trait_description(), advance_to(), swap(), and trait_names().

const unit_type* unit::type_
private

Definition at line 443 of file unit.hpp.

Referenced by advance_to(), swap(), type(), type_id(), and unit().

t_string unit::type_name_
private

Never nullptr. Adjusted for gender and variation.

Definition at line 444 of file unit.hpp.

Referenced by advance_to(), swap(), type_name(), and write().

std::string unit::undead_variation_
private

Definition at line 449 of file unit.hpp.

Referenced by advance_to(), swap(), undead_variation(), unit(), and write().

n_unit::unit_id unit::underlying_id_
private

Definition at line 448 of file unit.hpp.

Referenced by clone(), is_visible_to_team(), set_underlying_id(), swap(), underlying_id(), unit(), and write().

int unit::unit_value_
private

Definition at line 507 of file unit.hpp.

Referenced by advance_to(), cost(), swap(), unit(), and write().

bool unit::unrenamable_
private

Definition at line 466 of file unit.hpp.

Referenced by rename(), set_unrenamable(), swap(), unit(), unrenamable(), and write().

t_upkeep unit::upkeep_
private
boost::scoped_ptr<std::string> unit::usage_
private

Definition at line 527 of file unit.hpp.

Referenced by set_usage(), usage(), and write().

config unit::variables_
private

Definition at line 490 of file unit.hpp.

Referenced by swap(), unit(), variables(), and write().

std::string unit::variation_
private

Definition at line 450 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), swap(), variation(), and write().

int unit::vision_
private

Definition at line 478 of file unit.hpp.

Referenced by advance_to(), apply_builtin_effect(), swap(), unit(), vision(), and write().

double unit::xp_bar_scaling_
private

Definition at line 521 of file unit.hpp.

Referenced by advance_to(), and xp_bar_scaling().


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