Classes | |
class | unit::recursion_guard |
Helper similar to std::unique_lock for detecting when calculations such as abilities have entered infinite recursion. More... | |
Enumerations | |
enum class | backwards_compatibility::unit_checksum_version { backwards_compatibility::current , backwards_compatibility::version_1_16_or_older } |
Optional parameter for get_checksum to use the algorithm of an older version of Wesnoth, thus preventing spurious OOS warnings while watching old replays. More... | |
Functions | |
static std::string | unit::upkeep_full::type () |
static std::string | unit::upkeep_loyal::type () |
unit::upkeep_value_visitor::upkeep_value_visitor (const unit &unit) | |
int | unit::upkeep_value_visitor::operator() (const upkeep_full &) const |
Full upkeep equals the unit's level. More... | |
int | unit::upkeep_value_visitor::operator() (const upkeep_loyal &) const |
Loyal units cost no upkeep. More... | |
int | unit::upkeep_value_visitor::operator() (int v) const |
template<typename T > | |
std::enable_if_t<!std::is_same_v< int, T >, std::string > | unit::upkeep_type_visitor::operator() (T &) const |
std::string | unit::upkeep_type_visitor::operator() (int v) const |
template<typename N > | |
std::enable_if_t< std::is_arithmetic_v< N >, upkeep_t > | unit::upkeep_parser_visitor::operator() (N n) const |
template<typename B > | |
std::enable_if_t< std::is_convertible_v< B, bool > &&!std::is_arithmetic_v< B >, upkeep_t > | unit::upkeep_parser_visitor::operator() (B b) const |
upkeep_t | unit::upkeep_parser_visitor::operator() (utils::monostate) const |
upkeep_t | unit::upkeep_parser_visitor::operator() (const std::string &s) const |
bool | unit::get_ability_bool (const std::string &tag_name, const map_location &loc) const |
Checks whether this unit currently possesses or is affected by a given ability. More... | |
bool | unit::get_ability_bool (const std::string &tag_name) const |
Checks whether this unit currently possesses or is affected by a given ability. More... | |
unit_ability_list | unit::get_abilities (const std::string &tag_name, const map_location &loc) const |
Gets the unit's active abilities of a particular type if it were on a specified location. More... | |
unit_ability_list | unit::get_abilities (const std::string &tag_name) const |
Gets the unit's active abilities of a particular type. More... | |
unit_ability_list | unit::get_abilities_weapons (const std::string &tag_name, const map_location &loc, const_attack_ptr weapon=nullptr, const_attack_ptr opp_weapon=nullptr) const |
unit_ability_list | unit::get_abilities_weapons (const std::string &tag_name, const_attack_ptr weapon=nullptr, const_attack_ptr opp_weapon=nullptr) const |
const config & | unit::abilities () const |
const std::set< std::string > & | unit::checking_tags () const |
std::vector< std::tuple< std::string, t_string, t_string, t_string > > | unit::ability_tooltips () const |
Gets the names and descriptions of this unit's abilities. More... | |
std::vector< std::tuple< std::string, t_string, t_string, t_string > > | unit::ability_tooltips (boost::dynamic_bitset<> &active_list, const map_location &loc) const |
Gets the names and descriptions of this unit's abilities. More... | |
std::vector< std::string > | unit::get_ability_list () const |
Get a list of all abilities by ID. More... | |
bool | unit::has_ability_type (const std::string &ability) const |
Check if the unit has an ability of a specific type. More... | |
bool | unit::has_ability_by_id (const std::string &ability) const |
Check if the unit has an ability of a specific ID. More... | |
void | unit::remove_ability_by_id (const std::string &ability) |
Removes a unit's abilities with a specific ID. More... | |
void | unit::remove_ability_by_attribute (const config &filter) |
Removes a unit's abilities with a specific ID or other attribute. More... | |
unit::recursion_guard::recursion_guard (const unit &u, const config &ability) | |
Only expected to be called in update_variables_recursion(), which handles some of the checks. More... | |
unit::recursion_guard::recursion_guard () | |
Construct an empty instance, only useful for extending the lifetime of a recursion_guard returned from unit.update_variables_recursion() by std::moving it to an instance declared in a larger scope. More... | |
unit::recursion_guard::operator bool () const | |
Returns true if a level of recursion was available at the time when update_variables_recursion() created this object. More... | |
unit::recursion_guard::recursion_guard (recursion_guard &&other) noexcept | |
unit::recursion_guard::recursion_guard (const recursion_guard &other)=delete | |
recursion_guard & | unit::recursion_guard::operator= (recursion_guard &&) noexcept |
recursion_guard & | unit::recursion_guard::operator= (const recursion_guard &)=delete |
unit::recursion_guard::~recursion_guard () | |
recursion_guard | unit::update_variables_recursion (const config &ability) const |
bool | unit::ability_active (const std::string &ability, const config &cfg, const map_location &loc) const |
Check if an ability is active. More... | |
bool | unit::ability_active_impl (const std::string &ability, const config &cfg, const map_location &loc) const |
Check if an ability is active. More... | |
bool | unit::ability_affects_adjacent (const std::string &ability, const config &cfg, std::size_t dist, int dir, const map_location &loc, const unit &from) const |
Check if an ability affects distant units. More... | |
bool | unit::ability_affects_self (const std::string &ability, const config &cfg, const map_location &loc) const |
Check if an ability affects the owning unit. More... | |
bool | unit::ability_affects_weapon (const config &cfg, const const_attack_ptr &weapon, bool is_opp) const |
filters the weapons that condition the use of abilities for combat ([resistance],[leadership] or abilities used like specials (deprecated in two last cases) More... | |
unit_formula_manager & | unit::formula_manager () const |
Get the unit formula manager. More... | |
void | unit::generate_name () |
Generates a random race-appropriate name if one has not already been provided. More... | |
bool | unit::invisible (const map_location &loc, bool see_all=true) const |
bool | unit::is_visible_to_team (const team &team, bool const see_all=true) const |
bool | unit::is_visible_to_team (const map_location &loc, const team &team, bool const see_all=true) const |
Return true if the unit would be visible to team if its location were loc. More... | |
void | unit::write (config &cfg, bool write_all=true) const |
Serializes the current unit metadata values. More... | |
unit & | unit::mark_clone (bool is_temporary) |
Mark this unit as clone so it can be inserted to unit_map. More... | |
void | unit::set_appearance_changed (bool value) |
bool | unit::appearance_changed () const |
bool | unit::favorite () const |
void | unit::set_favorite (bool favorite) |
void | unit::parse_upkeep (const config::attribute_value &upkeep) |
void | unit::write_upkeep (config::attribute_value &upkeep) const |
void | unit::clear_visibility_cache () const |
Clears the cache. More... | |
void | unit::set_has_ability_distant () |
unit_movement_resetter::unit_movement_resetter (const unit_movement_resetter &)=delete | |
unit_movement_resetter & | unit_movement_resetter::operator= (const unit_movement_resetter &)=delete |
unit_movement_resetter::unit_movement_resetter (const unit &u, bool operate=true) | |
unit_movement_resetter::~unit_movement_resetter () | |
Friends | |
class | unit::recursion_guard::unit |
class | unit::unit_animation_component |
already added | |
bool | unit::get_self_ability_bool (const config &cfg, const std::string &ability, const map_location &loc) const |
Checks whether this unit currently possesses a given ability, and that that ability is active. More... | |
bool | unit::get_self_ability_bool_weapon (const config &special, const std::string &tag_name, const map_location &loc, const const_attack_ptr &weapon=nullptr, const const_attack_ptr &opp_weapon=nullptr) const |
Checks whether this unit currently possesses a given ability of leadership type. More... | |
bool | unit::get_adj_ability_bool (const config &cfg, const std::string &ability, std::size_t dist, int dir, const map_location &loc, const unit &from, const map_location &from_loc) const |
Checks whether this unit is affected by a given ability, and that that ability is active. More... | |
bool | unit::get_adj_ability_bool_weapon (const config &special, const std::string &tag_name, std::size_t dist, int dir, const map_location &loc, const unit &from, const map_location &from_loc, const const_attack_ptr &weapon, const const_attack_ptr &opp_weapon) const |
Checks whether this unit is affected by a given ability of leadership type. More... | |
bool | unit::ability_matches_filter (const config &cfg, const std::string &tag_name, const config &filter) const |
Verify what abilities attributes match with filter. More... | |
|
strong |
|
inline |
Definition at line 1839 of file unit.hpp.
References unit::abilities_.
Referenced by unit::advance_to(), unit_filter_impl::unit_filter_compound::fill(), unit::init(), and unit::unit_special_notes().
|
private |
Check if an ability is active.
Includes checks to prevent excessive recursion.
ability | The type (tag name) of the ability |
cfg | an ability WML structure |
loc | The location on which to resolve the ability |
Definition at line 451 of file abilities.cpp.
References unit::ability_active_impl(), loc, and unit::update_variables_recursion().
Referenced by unit::ability_tooltips(), and unit::halo_or_icon_abilities().
|
private |
Check if an ability is active.
The caller is responsible for preventing excessive recursion, so must hold a recursion_guard.
ability | The type (tag name) of the ability |
cfg | an ability WML structure |
loc | The location on which to resolve the ability |
Definition at line 536 of file abilities.cpp.
References ability_active_adjacent_helper(), loc, and config::optional_child().
Referenced by unit::ability_active(), and unit::get_adj_ability_bool().
|
private |
Check if an ability affects distant units.
ability | The type (tag name) of the ability |
cfg | an ability WML structure |
loc | The location on which to resolve the ability |
from | The "other unit" for filter matching |
dist | distance between unit distant and this. |
dir | direction to research a unit distant to this. |
Definition at line 551 of file abilities.cpp.
References config::child_range(), utils::views::filter, utils::find(), config::has_child(), i, loc, and map_location::parse_directions().
|
private |
Check if an ability affects the owning unit.
ability | The type (tag name) of the ability |
cfg | an ability WML structure |
loc | The location on which to resolve the ability |
Definition at line 588 of file abilities.cpp.
References utils::views::filter, loc, unit_filter::matches(), config::optional_child(), and unit_filter::set_use_flat_tod().
Referenced by unit::halo_or_icon_abilities().
|
private |
filters the weapons that condition the use of abilities for combat ([resistance],[leadership] or abilities used like specials (deprecated in two last cases)
Definition at line 596 of file abilities.cpp.
References utils::views::filter, config::has_child(), and config::mandatory_child().
Referenced by unit::get_abilities_weapons().
bool unit::ability_matches_filter | ( | const config & | cfg, |
const std::string & | tag_name, | ||
const config & | filter | ||
) | const |
Verify what abilities attributes match with filter.
cfg | the config of ability to check. |
tag_name | the tag name of ability to check. |
filter | the filter used for checking. |
Definition at line 2129 of file abilities.cpp.
References utils::views::filter.
Referenced by unit::remove_ability_by_attribute().
std::vector< std::tuple< std::string, t_string, t_string, t_string > > unit::ability_tooltips | ( | ) | const |
Gets the names and descriptions of this unit's abilities.
Location-independent variant with all abilities shown as active.
Definition at line 350 of file abilities.cpp.
References unit::abilities_, config::all_children_view(), and unit::gender_.
Referenced by gui2::unit_preview_pane::set_display_data(), and unit_abilities().
std::vector< std::tuple< std::string, t_string, t_string, t_string > > unit::ability_tooltips | ( | boost::dynamic_bitset<> & | active_list, |
const map_location & | loc | ||
) | const |
Gets the names and descriptions of this unit's abilities.
active_list | This vector will be the same length as the returned one and will indicate whether or not the corresponding ability is active. |
loc | The location on which to resolve the ability. |
Definition at line 362 of file abilities.cpp.
References unit::abilities_, unit::ability_active(), config::all_children_view(), unit::gender_, and loc.
|
inline |
Definition at line 2021 of file unit.hpp.
References unit::appearance_changed_.
|
inline |
Definition at line 1841 of file unit.hpp.
References unit::checking_tags_.
Referenced by unit_display::reset_helpers(), unit_display::unit_attack(), attack_type::weapon_specials_impl_adj(), attack_type::weapon_specials_impl_self(), and attack_type::weapon_specials_value().
|
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 2182 of file unit.hpp.
References unit::invisibility_cache_.
|
inline |
Definition at line 2128 of file unit.hpp.
References unit::is_favorite_.
Referenced by gui2::dialogs::units_dialog::build_recall_dialog(), gui2::dialogs::units_dialog::build_unit_list_dialog(), unit::set_favorite(), and gui2::dialogs::units_dialog::toggle_favorite().
|
inline |
Get the unit formula manager.
Definition at line 1989 of file unit.hpp.
References unit::formula_man_.
Referenced by wfl::set_unit_var_callable::execute_self(), and wfl::unit_callable::get_value().
void unit::generate_name | ( | ) |
Generates a random race-appropriate name if one has not already been provided.
Definition at line 833 of file unit.cpp.
References t_string::empty(), unit::gender_, unit_race::generate_name(), unit::generate_name_, unit::name_, and unit::race_.
Referenced by unit::init().
|
inline |
Gets the unit's active abilities of a particular type.
tag_name | The type of ability to check for |
Definition at line 1827 of file unit.hpp.
References unit::get_abilities(), and unit::loc_.
unit_ability_list unit::get_abilities | ( | const std::string & | tag_name, |
const map_location & | loc | ||
) | const |
Gets the unit's active abilities of a particular type if it were on a specified location.
tag_name | The type of ability to check for |
loc | The location to use for resolving abilities |
Definition at line 243 of file abilities.cpp.
References unit::abilities_, config::child_range(), distance_between(), unit_ability_list::emplace_back(), unit::get_adj_ability_bool(), unit::get_self_ability_bool(), i, loc, and unit::loc_.
Referenced by unit::defense_modifier(), unit_filter_impl::unit_filter_compound::fill(), unit::get_abilities(), unit::get_abilities_weapons(), pathfind::get_teleport_locations(), and unit_display::reset_helpers().
unit_ability_list unit::get_abilities_weapons | ( | const std::string & | tag_name, |
const map_location & | loc, | ||
const_attack_ptr | weapon = nullptr , |
||
const_attack_ptr | opp_weapon = nullptr |
||
) | const |
Definition at line 285 of file abilities.cpp.
References unit::ability_affects_weapon(), utils::erase_if(), unit::get_abilities(), i, and loc.
Referenced by unit::get_abilities_weapons(), unit::resistance_against(), under_leadership(), and unit_display::unit_attack().
|
inline |
Definition at line 1834 of file unit.hpp.
References unit::get_abilities_weapons(), and unit::loc_.
|
inline |
Checks whether this unit currently possesses or is affected by a given ability.
This means that the ability could be owned by this unit itself or by an adjacent unit, should the ability affect an AoE in which this unit happens to be.
This overload uses the location of this unit for calculations.
tag_name | The name of the ability to check for. |
Definition at line 1768 of file unit.hpp.
References unit::get_ability_bool(), and unit::loc_.
bool unit::get_ability_bool | ( | const std::string & | tag_name, |
const map_location & | loc | ||
) | const |
Checks whether this unit currently possesses or is affected by a given ability.
This means that the ability could be owned by this unit itself or by an adjacent unit, should the ability affect an AoE in which this unit happens to be.
tag_name | The name of the ability to check for. |
loc | The location around which to check for affected units. This may or may not be the location of this unit. |
Definition at line 203 of file abilities.cpp.
References unit::abilities_, config::child_range(), distance_between(), unit::get_adj_ability_bool(), unit::get_self_ability_bool(), i, and loc.
Referenced by pathfind::shortest_path_calculator::cost(), ai::ai_default_rca::get_healing_phase::evaluate(), pathfind::find_routes(), unit::get_ability_bool(), game_lua_kernel::intf_unit_ability(), unit::invisible(), pathfind::mark_route(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), and ai::default_ai_context_impl::rate_terrain().
std::vector< std::string > unit::get_ability_list | ( | ) | const |
Get a list of all abilities by ID.
Definition at line 294 of file abilities.cpp.
References unit::abilities_, and config::all_children_view().
Referenced by wfl::unit_callable::get_value(), gui2::unit_preview_pane::set_display_data(), and UNIT_GETTER().
bool unit::get_adj_ability_bool | ( | const config & | cfg, |
const std::string & | ability, | ||
std::size_t | dist, | ||
int | dir, | ||
const map_location & | loc, | ||
const unit & | from, | ||
const map_location & | from_loc | ||
) | const |
Checks whether this unit is affected by a given ability, and that that ability is active.
cfg | the const config to one of abilities ability checked. |
ability | name of ability type checked. |
loc | location of the unit checked. |
from | unit distant to this is checked in case of [affect_adjacent] abilities. |
from_loc | the 'other unit' location. |
dist | distance between unit distant and this. |
dir | direction to research a unit distant to this. |
Definition at line 1701 of file abilities.cpp.
References unit::ability_active_impl(), loc, unit::side(), and unit::update_variables_recursion().
Referenced by unit_filter_impl::unit_filter_compound::fill(), unit::get_abilities(), unit::get_ability_bool(), and unit::halo_or_icon_abilities().
bool unit::get_adj_ability_bool_weapon | ( | const config & | special, |
const std::string & | tag_name, | ||
std::size_t | dist, | ||
int | dir, | ||
const map_location & | loc, | ||
const unit & | from, | ||
const map_location & | from_loc, | ||
const const_attack_ptr & | weapon, | ||
const const_attack_ptr & | opp_weapon | ||
) | const |
Checks whether this unit is affected by a given ability of leadership type.
special | the const config to one of abilities tag_name checked. |
tag_name | name of ability type checked. |
loc | location of the unit checked. |
from | unit adjacent to this is checked in case of [affect_adjacent] abilities. |
from_loc | location of the from unit. |
weapon | the attack used by unit checked in this function. |
opp_weapon | the attack used by opponent to unit checked. |
dist | distance between unit distant and this. |
dir | direction to research a unit distant to this. |
Definition at line 1716 of file abilities.cpp.
References loc.
bool unit::get_self_ability_bool | ( | const config & | cfg, |
const std::string & | ability, | ||
const map_location & | loc | ||
) | const |
Checks whether this unit currently possesses a given ability, and that that ability is active.
cfg | the const config to one of abilities tag_name checked. |
ability | name of ability type checked. |
loc | location of the unit checked. |
Definition at line 1691 of file abilities.cpp.
References loc, and attack_type::update_variables_recursion().
Referenced by unit_filter_impl::unit_filter_compound::fill(), unit::get_abilities(), and unit::get_ability_bool().
bool unit::get_self_ability_bool_weapon | ( | const config & | special, |
const std::string & | tag_name, | ||
const map_location & | loc, | ||
const const_attack_ptr & | weapon = nullptr , |
||
const const_attack_ptr & | opp_weapon = nullptr |
||
) | const |
Checks whether this unit currently possesses a given ability of leadership type.
special | the const config to one of abilities tag_name checked. |
tag_name | name of ability type checked. |
loc | location of the unit checked. |
weapon | the attack used by unit checked in this function. |
opp_weapon | the attack used by opponent to unit checked. |
Definition at line 1711 of file abilities.cpp.
References loc.
bool unit::has_ability_by_id | ( | const std::string & | ability | ) | const |
Check if the unit has an ability of a specific ID.
ability | The ID of ability to check for. |
Definition at line 1508 of file unit.cpp.
References unit::abilities_, and config::all_children_view().
Referenced by unit::apply_builtin_effect(), and unit_filter_impl::unit_filter_compound::fill().
bool unit::has_ability_type | ( | const std::string & | ability | ) | const |
Check if the unit has an ability of a specific type.
ability | The type of ability (tag name) to check for. |
Definition at line 615 of file abilities.cpp.
References unit::abilities_, and config::child_range().
Referenced by unit_filter_impl::unit_filter_compound::fill().
bool unit::invisible | ( | const map_location & | loc, |
bool | see_all = true |
||
) | const |
Definition at line 2617 of file unit.cpp.
References DBG_UT, resources::gameboard, unit::get_ability_bool(), unit::get_location(), unit::get_state(), unit::id(), unit::invisibility_cache_, loc, unit::side_, unit::STATE_UNCOVERED, and display_context::would_be_discovered().
Referenced by gui2::dialogs::units_dialog::build_unit_list_dialog(), wfl::attack_map_callable::collect_possible_attacks(), unit::is_visible_to_team(), pathfind::mark_route(), unit_drawer::redraw_unit(), and unit_status().
bool unit::is_visible_to_team | ( | const map_location & | loc, |
const team & | team, | ||
bool const | see_all = true |
||
) | const |
Return true if the unit would be visible to team if its location were loc.
Definition at line 2666 of file unit.cpp.
References team::fogged(), display::get_singleton(), unit::invisible(), team::is_enemy(), n_unit::unit_id::is_fake(), loc, team::side(), unit::side(), and unit::underlying_id_.
bool unit::is_visible_to_team | ( | const team & | team, |
bool const | see_all = true |
||
) | const |
Definition at line 2660 of file unit.cpp.
References unit::get_location(), and loc.
Referenced by actions::actor_sighted(), actions::get_sides_not_seeing(), and unit_drawer::redraw_unit().
unit & unit::mark_clone | ( | bool | is_temporary | ) |
Mark this unit as clone so it can be inserted to unit_map.
Definition at line 2718 of file unit.cpp.
References resources::gameboard, resources::gamedata, n_unit::id_manager::global_instance(), unit::id_, game_data::INITIAL, synced_context::is_synced(), n_unit::id_manager::next_fake_id(), n_unit::id_manager::next_id(), unit::set_underlying_id(), unit::underlying_id_, game_board::unit_id_manager(), and WRN_UT.
Referenced by temporary_unit_placer::temporary_unit_placer().
unit::recursion_guard::operator bool | ( | ) | const |
Returns true if a level of recursion was available at the time when update_variables_recursion() created this object.
Definition at line 431 of file abilities.cpp.
|
inline |
|
inline |
|
inline |
Full upkeep equals the unit's level.
Definition at line 1203 of file unit.hpp.
References unit::level(), and unit::upkeep_value_visitor::u_.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
delete |
|
delete |
|
noexcept |
Definition at line 435 of file abilities.cpp.
References swap().
|
private |
Definition at line 2843 of file unit.cpp.
References e, unit::upkeep(), unit::upkeep_, and WRN_UT.
Referenced by unit::advance_to(), and unit::init().
|
explicitdefault |
Construct an empty instance, only useful for extending the lifetime of a recursion_guard returned from unit.update_variables_recursion() by std::moving it to an instance declared in a larger scope.
|
delete |
Only expected to be called in update_variables_recursion(), which handles some of the checks.
Definition at line 420 of file abilities.cpp.
References unit::open_queries_.
|
noexcept |
Definition at line 426 of file abilities.cpp.
References swap().
void unit::remove_ability_by_attribute | ( | const config & | filter | ) |
Removes a unit's abilities with a specific ID or other attribute.
filter | the config of ability to remove. |
Definition at line 1532 of file unit.cpp.
References unit::abilities_, unit::ability_matches_filter(), config::erase(), utils::views::filter, i, config::ordered_begin(), config::ordered_end(), unit::set_attr_changed(), and unit::UA_ABILITIES.
Referenced by unit::apply_builtin_effect().
void unit::remove_ability_by_id | ( | const std::string & | ability | ) |
Removes a unit's abilities with a specific ID.
ability | The type of ability (tag name) to remove. |
Definition at line 1519 of file unit.cpp.
References unit::abilities_, config::erase(), i, config::ordered_begin(), config::ordered_end(), unit::set_attr_changed(), and unit::UA_ABILITIES.
Referenced by unit::apply_builtin_effect().
|
inline |
Definition at line 2020 of file unit.hpp.
References unit::appearance_changed_.
|
inline |
Definition at line 2130 of file unit.hpp.
References unit::favorite(), and unit::is_favorite_.
Referenced by gui2::dialogs::units_dialog::toggle_favorite().
|
private |
Definition at line 418 of file unit.cpp.
References unit::abilities_, unit::affect_distant_, config::all_children_view(), unit::has_ability_distant_, unit::has_ability_distant_image_, and i.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), and unit::init().
|
inlinestatic |
|
inlinestatic |
Definition at line 1188 of file unit.hpp.
Referenced by unit::apply_builtin_effect().
unit_movement_resetter::unit_movement_resetter | ( | const unit & | u, |
bool | operate = true |
||
) |
Definition at line 2743 of file unit.cpp.
References unit::set_movement(), unit::total_movement(), and unit_movement_resetter::u_.
|
delete |
|
private |
Definition at line 410 of file abilities.cpp.
References utils::contains(), and unit::open_queries_.
Referenced by unit::ability_active(), and unit::get_adj_ability_bool().
|
inlineexplicit |
void unit::write | ( | config & | cfg, |
bool | write_all = true |
||
) | const |
Serializes the current unit metadata values.
cfg | The config to write to. |
write_all | set this to false to not write unchanged attributes. |
Definition at line 1556 of file unit.cpp.
References unit::abilities_, config::add_child(), unit::advancements_, unit::advances_to_, unit::alignment_, config::append(), unit::attacks_, unit::attacks_left_, unit::can_recruit(), config::clear_children(), unit::description_, unit::dismiss_message_, unit::dismissable_, unit::ellipse_, unit::emit_zoc_, unit::events_, unit::experience_, unit::facing_, unit::filter_recall_, unit::flag_rgb_, unit::formula_man_, unit::gender_, gender_string(), unit::generate_name_, unit::get_attacks_changed(), unit::get_attr_changed(), unit::get_states(), string_enums::enum_base< Definition >::get_string(), unit::goto_, unit::halo_, unit::hidden_, unit::hit_points_, i, unit_type::icon(), unit_race::id(), unit::id_, unit_type::image(), unit::is_favorite_, unit::jamming_, utils::join(), unit::level_, unit::max_attacks_, unit::max_experience_, unit::max_hit_points_, unit::max_movement_, unit::modifications_, unit::movement_, unit::movement_type_, unit::name_, unit_type::parent_id(), unit::profile_, unit::race_, unit::random_traits_, unit::recall_cost_, unit::recruit_list_, unit::resting_, unit::role_, unit::side_, unit::small_profile_, unit::special_notes_, unit::type(), unit::type_id(), unit::type_name_, unit::UA_ABILITIES, unit::UA_ADVANCE_TO, unit::UA_ADVANCEMENTS, unit::UA_ALIGNMENT, unit::UA_ATTACKS, unit::UA_LEVEL, unit::UA_MAX_AP, unit::UA_MAX_HP, unit::UA_MAX_MP, unit::UA_MAX_XP, unit::UA_MOVEMENT_TYPE, unit::UA_NOTES, unit::UA_PROFILE, unit::UA_SMALL_PROFILE, unit::UA_ZOC, unit::undead_variation_, unit::underlying_id_, unit_type::unit_description(), unit::unit_value_, unit::unrenamable_, unit::usage_, n_unit::unit_id::value, unit::variables_, unit::variation_, unit::vision_, map_location::wml_x(), map_location::wml_y(), movetype::write(), map_location::write_direction(), and unit::write_upkeep().
Referenced by get_checksum(), and UNIT_GETTER().
|
private |
Definition at line 2857 of file unit.cpp.
References unit::upkeep(), and unit::upkeep_.
Referenced by unit::write().
unit::recursion_guard::~recursion_guard | ( | ) |
Definition at line 443 of file abilities.cpp.
unit_movement_resetter::~unit_movement_resetter | ( | ) |
Definition at line 2752 of file unit.cpp.
References DBG_UT, resources::gameboard, utils::get_unknown_exception_type(), unit_movement_resetter::moves_, unit::set_movement(), and unit_movement_resetter::u_.
|
private |
Definition at line 2144 of file unit.hpp.
Referenced by unit::abilities(), unit::ability_tooltips(), unit::advance_to(), unit::apply_builtin_effect(), unit::get_abilities(), unit::get_ability_bool(), unit::get_ability_list(), unit::halo_or_icon_abilities(), unit::has_ability_by_id(), unit::has_ability_type(), unit::init(), unit::remove_ability_by_attribute(), unit::remove_ability_by_id(), unit::set_has_ability_distant(), and unit::write().
|
private |
Definition at line 2146 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::modification_advancements(), unit::set_advancements(), and unit::write().
|
private |
Definition at line 2028 of file unit.hpp.
Referenced by unit::advance_to(), unit::advancement_icons(), unit::advances_to(), unit::advances_to_translated(), unit::apply_builtin_effect(), unit::can_advance(), unit::get_modification_advances(), unit::set_advances_to(), and unit::write().
|
private |
Used for easing checking if unit own a ability of specified type with [affect_adjacent] sub tag.
Definition at line 2191 of file unit.hpp.
Referenced by unit::affect_distant(), unit::set_has_ability_distant(), and unit::unit().
|
private |
Definition at line 2056 of file unit.hpp.
Referenced by unit::advance_to(), unit::alignment(), unit::init(), unit::set_alignment(), and unit::write().
|
private |
Definition at line 2139 of file unit.hpp.
Referenced by unit::advance_to(), unit::anim_comp(), unit::apply_builtin_effect(), unit::expire_modifications(), unit::init(), unit::set_hidden(), unit::set_image_halo(), and unit::~unit().
|
mutableprivate |
Definition at line 2164 of file unit.hpp.
Referenced by unit::advance_to(), unit::appearance_changed(), unit::apply_builtin_effect(), unit::set_appearance_changed(), unit::set_facing(), unit::set_image_ellipse(), unit::set_image_halo(), and unit::set_state().
|
private |
Definition at line 2101 of file unit.hpp.
Referenced by unit::add_attack(), unit::advance_to(), unit::apply_builtin_effect(), unit::attacks(), unit::clear_changed_attributes(), unit::describe_builtin_effect(), unit::get_attacks_changed(), unit::init(), unit::remove_attack(), unit::unit(), and unit::write().
|
private |
Definition at line 2082 of file unit.hpp.
Referenced by unit::attacks_left(), unit::init(), unit::new_turn(), unit::remove_attacks_ai(), unit::set_attacks(), and unit::write().
|
private |
Definition at line 2054 of file unit.hpp.
Referenced by unit::can_recruit(), unit::init(), and unit::set_can_recruit().
|
private |
Definition at line 2165 of file unit.hpp.
Referenced by unit::clear_changed_attributes(), unit::get_attr_changed(), and unit::set_attr_changed().
|
private |
Definition at line 1945 of file unit.hpp.
Referenced by unit::checking_tags().
|
private |
Definition at line 2148 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::set_unit_description(), unit::unit_description(), and unit::write().
|
private |
Definition at line 2063 of file unit.hpp.
Referenced by unit::block_dismiss_message(), unit::init(), and unit::write().
|
private |
Definition at line 2062 of file unit.hpp.
Referenced by unit::dismissable(), unit::init(), and unit::write().
|
private |
Definition at line 2153 of file unit.hpp.
Referenced by unit::advance_to(), unit::image_ellipse(), unit::set_image_ellipse(), and unit::write().
|
private |
Definition at line 2096 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::emits_zoc(), unit::get_emit_zoc(), unit::set_emit_zoc(), and unit::write().
|
private |
Definition at line 2079 of file unit.hpp.
Referenced by unit::new_turn(), unit::set_movement(), unit::set_user_end_turn(), unit::toggle_hold_position(), unit::toggle_user_end_turn(), and unit::user_end_turn().
|
private |
Definition at line 2093 of file unit.hpp.
Referenced by unit::init(), and unit::write().
|
private |
Definition at line 2048 of file unit.hpp.
Referenced by unit::advances(), unit::apply_builtin_effect(), unit::experience(), unit::experience_overflow(), unit::experience_to_advance(), unit::init(), unit::set_experience(), and unit::write().
|
mutableprotected |
Definition at line 2112 of file unit.hpp.
Referenced by unit::facing(), unit::init(), unit::set_facing(), and unit::write().
|
private |
Definition at line 2094 of file unit.hpp.
Referenced by unit::init(), unit::recall_filter(), unit::set_recall_filter(), and unit::write().
|
private |
Definition at line 2058 of file unit.hpp.
Referenced by unit::advance_to(), unit::flag_rgb(), and unit::write().
|
private |
Definition at line 2069 of file unit.hpp.
Referenced by unit::formula_manager(), unit::init(), and unit::write().
|
private |
Definition at line 2067 of file unit.hpp.
Referenced by unit::ability_tooltips(), unit::add_trait_description(), unit::advance_to(), unit::apply_builtin_effect(), unit::gender(), unit::generate_name(), unit::init(), and unit::write().
|
private |
Definition at line 2156 of file unit.hpp.
Referenced by unit::advance_to(), unit::generate_name(), unit::init(), and unit::write().
|
private |
Definition at line 2120 of file unit.hpp.
Referenced by unit::get_goto(), unit::init(), unit::new_scenario(), unit::set_goto(), and unit::write().
|
private |
Definition at line 2152 of file unit.hpp.
Referenced by unit::image_halo(), unit::set_image_halo(), and unit::write().
|
private |
Used for easing checking if unit own a ability with [affect_adjacent] sub tag.
Definition at line 2196 of file unit.hpp.
Referenced by unit::has_ability_distant(), and unit::set_has_ability_distant().
|
private |
used if ability own halo_image or overlay_image attributes in same time what [affect_adjacent].
Definition at line 2200 of file unit.hpp.
Referenced by unit::has_ability_distant_image(), and unit::set_has_ability_distant().
|
mutableprivate |
Definition at line 2141 of file unit.hpp.
Referenced by unit::get_hidden(), unit::init(), unit::set_hidden(), and unit::write().
|
private |
Definition at line 2046 of file unit.hpp.
Referenced by unit::apply_builtin_effect(), unit::heal(), unit::heal_fully(), unit::hitpoints(), unit::init(), unit::set_hitpoints(), unit::take_hit(), and unit::write().
|
private |
Definition at line 2078 of file unit.hpp.
Referenced by unit::hold_position(), unit::new_turn(), unit::set_movement(), unit::toggle_hold_position(), and unit::toggle_user_end_turn().
|
private |
Definition at line 2039 of file unit.hpp.
Referenced by unit::id(), unit::init(), unit::mark_clone(), unit::set_id(), unit::set_underlying_id(), and unit::write().
|
private |
Definition at line 2059 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::effect_image_mods(), and unit::image_mods().
|
private |
Definition at line 2120 of file unit.hpp.
Referenced by unit::get_interrupted_move(), unit::move_interrupted(), and unit::set_interrupted_move().
|
mutableprivate |
Hold the visibility status cache for a unit, when not uncovered.
This is mutable since it is a cache.
Definition at line 2174 of file unit.hpp.
Referenced by unit::clear_visibility_cache(), and unit::invisible().
|
private |
Definition at line 2125 of file unit.hpp.
Referenced by unit::favorite(), unit::init(), unit::set_favorite(), and unit::write().
|
private |
Definition at line 2122 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), and unit::is_fearless().
|
private |
Definition at line 2122 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), and unit::is_healthy().
|
private |
Definition at line 2074 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::jamming(), and unit::write().
|
staticprivate |
Definition at line 2090 of file unit.hpp.
Referenced by unit::get_known_boolean_state_id(), unit::get_known_boolean_state_name(), and unit::get_states().
|
private |
Definition at line 2089 of file unit.hpp.
Referenced by unit::get_state(), and unit::set_state().
|
private |
Definition at line 2051 of file unit.hpp.
Referenced by unit::add_modification(), unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::level(), unit::set_level(), and unit::write().
|
private |
Definition at line 2026 of file unit.hpp.
Referenced by unit::add_modification(), unit::get_abilities(), unit::get_abilities_weapons(), unit::get_ability_bool(), unit::get_location(), unit::get_modification_advances(), unit::halo_or_icon_abilities(), unit::init(), and unit::set_location().
|
private |
Definition at line 2083 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::max_attacks(), unit::new_turn(), unit::remove_attacks_ai(), unit::set_max_attacks(), and unit::write().
|
private |
Definition at line 2049 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::experience_overflow(), unit::experience_to_advance(), unit::init(), unit::max_experience(), unit::set_max_experience(), and unit::write().
|
private |
Definition at line 2047 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::max_hitpoints(), unit::set_max_hitpoints(), and unit::write().
|
private |
Definition at line 2072 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::set_total_movement(), unit::total_movement(), unit::vision(), and unit::write().
|
private |
Definition at line 2134 of file unit.hpp.
Referenced by unit::advance_to().
|
private |
Definition at line 2143 of file unit.hpp.
Referenced by unit::add_modification(), unit::apply_modifications(), unit::expire_modifications(), unit::generate_traits(), unit::get_modifications(), unit::get_modifications_list(), unit::init(), unit::modification_count(), and unit::write().
|
private |
Definition at line 2071 of file unit.hpp.
Referenced by unit::apply_builtin_effect(), unit::end_turn(), unit::init(), unit::movement_left(), unit::new_turn(), unit::set_movement(), and unit::write().
|
private |
Definition at line 2076 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::defense_modifier(), unit::get_base_resistances(), unit::init(), unit::is_flying(), unit::jamming_cost(), unit::movement_cost(), unit::movement_type(), unit::resistance_value(), unit::vision_cost(), and unit::write().
|
private |
Definition at line 2220 of file unit.hpp.
Referenced by unit_movement_resetter::~unit_movement_resetter().
|
private |
Definition at line 2040 of file unit.hpp.
Referenced by unit::generate_name(), unit::init(), unit::name(), unit::rename(), unit::set_name(), and unit::write().
|
staticprivate |
|
mutableprivate |
While processing a recursive match, all the filters that are currently being checked, oldest first.
Each will have an instance of recursion_guard that is currently allocated permission to recurse, and which will pop the config off this stack when the recursion_guard is finalized.
Definition at line 2107 of file unit.hpp.
Referenced by unit::recursion_guard::recursion_guard(), and unit::update_variables_recursion().
|
private |
Definition at line 2098 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::overlays(), and unit::set_loyal().
|
private |
|
private |
Definition at line 2160 of file unit.hpp.
Referenced by unit::advance_to(), unit::big_profile(), unit::set_big_profile(), unit::small_profile(), and unit::write().
|
private |
Never nullptr, but may point to the null race.
Definition at line 2037 of file unit.hpp.
Referenced by unit::advance_to(), unit::generate_name(), unit::init(), unit::race(), and unit::write().
|
private |
Definition at line 2155 of file unit.hpp.
Referenced by unit::advance_to(), unit::generate_traits(), unit::init(), and unit::write().
|
private |
Definition at line 2053 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::recall_cost(), unit::set_recall_cost(), and unit::write().
|
private |
Definition at line 2055 of file unit.hpp.
Referenced by unit::recruits(), unit::set_recruits(), and unit::write().
|
private |
Definition at line 2080 of file unit.hpp.
Referenced by unit::end_turn(), unit::init(), unit::resting(), unit::set_resting(), and unit::write().
|
private |
Definition at line 2100 of file unit.hpp.
Referenced by unit::get_role(), unit::init(), unit::set_role(), and unit::write().
|
private |
Definition at line 2065 of file unit.hpp.
Referenced by unit::apply_builtin_effect(), unit::init(), unit::invisible(), unit::set_side(), unit::side(), and unit::write().
|
private |
Definition at line 2161 of file unit.hpp.
Referenced by unit::advance_to(), unit::set_small_profile(), unit::small_profile(), and unit::write().
|
private |
Definition at line 2149 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::unit_special_notes(), and unit::write().
|
private |
Definition at line 2085 of file unit.hpp.
Referenced by unit::get_state(), unit::get_states(), and unit::set_state().
|
private |
Definition at line 2116 of file unit.hpp.
Referenced by unit::add_trait_description(), unit::advance_to(), and unit::trait_descriptions().
|
private |
Definition at line 2115 of file unit.hpp.
Referenced by unit::add_trait_description(), unit::advance_to(), and unit::trait_names().
|
private |
Definition at line 2117 of file unit.hpp.
Referenced by unit::add_trait_description(), unit::advance_to(), and unit::trait_nonhidden_ids().
|
private |
Never nullptr.
Adjusted for gender and variation.
Definition at line 2031 of file unit.hpp.
Referenced by unit::advance_to(), unit::init(), unit::type(), and unit::type_id().
|
private |
The displayed name of this unit type.
Definition at line 2034 of file unit.hpp.
Referenced by unit::advance_to(), unit::type_name(), and unit::write().
|
private |
Definition at line 1220 of file unit.hpp.
Referenced by unit::upkeep_value_visitor::operator()().
|
private |
Definition at line 2219 of file unit.hpp.
Referenced by unit_movement_resetter::unit_movement_resetter(), and unit_movement_resetter::~unit_movement_resetter().
|
private |
Definition at line 2043 of file unit.hpp.
Referenced by unit::advance_to(), unit::set_undead_variation(), unit::undead_variation(), and unit::write().
|
private |
Definition at line 2041 of file unit.hpp.
Referenced by unit::init(), unit::is_visible_to_team(), unit::mark_clone(), unit::set_underlying_id(), unit::underlying_id(), and unit::write().
|
private |
Definition at line 2119 of file unit.hpp.
Referenced by unit::advance_to(), unit::cost(), unit::init(), and unit::write().
|
private |
Definition at line 2061 of file unit.hpp.
Referenced by unit::init(), unit::rename(), unit::set_unrenamable(), unit::unrenamable(), and unit::write().
|
private |
Definition at line 2158 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::loyal(), unit::parse_upkeep(), unit::set_loyal(), unit::set_upkeep(), unit::upkeep(), unit::upkeep_raw(), and unit::write_upkeep().
|
private |
Definition at line 2151 of file unit.hpp.
Referenced by unit::set_usage(), unit::usage(), and unit::write().
|
private |
Definition at line 2092 of file unit.hpp.
Referenced by unit::apply_modifications(), unit::init(), unit::variables(), and unit::write().
|
private |
Definition at line 2044 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::variation(), and unit::write().
|
private |
Definition at line 2073 of file unit.hpp.
Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), unit::vision(), and unit::write().
|
friend |