#include <unit.hpp>
Public Types | |
enum | STATE { STATE_STANDING, STATE_FORGET, STATE_ANIM } |
States for animation. More... | |
Public Member Functions | |
unit (const unit &u) | |
unit (const config &cfg, bool use_traits=false) | |
Initilizes a unit from a config. | |
unit (unit_map *unitmap, const gamemap *map, const gamestatus *game_status, const std::vector< team > *teams, const config &cfg, bool use_traits=false, game_state *state=0) | |
unit (const unit_type *t, int side, bool use_traits=false, bool dummy_unit=false, unit_race::GENDER gender=unit_race::MALE, std::string variation="") | |
Initializes a unit from a unit type. | |
unit (unit_map *unitmap, const gamemap *map, const gamestatus *game_status, const std::vector< team > *teams, const unit_type *t, int side, bool use_traits=false, bool dummy_unit=false, unit_race::GENDER gender=unit_race::MALE, std::string variation="") | |
virtual | ~unit () |
unit & | operator= (const unit &) |
void | set_game_context (unit_map *unitmap, const gamemap *map, const gamestatus *game_status, const std::vector< team > *teams) |
void | advance_to (const unit_type *t, bool use_traits=false, game_state *state=0) |
Advances this unit to another type. | |
const std::vector< std::string > | advances_to () const |
const std::string & | type_id () const |
The type id of the unit. | |
const unit_type * | type () const |
const std::string & | id () const |
The unique internal ID of the unit. | |
const std::string & | underlying_id () const |
const t_string & | type_name () const |
The unit type name. | |
const std::string & | undead_variation () const |
const std::string & | name () const |
The unit name for display. | |
void | rename (const std::string &name) |
const std::string & | profile () const |
The unit's profile. | |
const std::string & | unit_description () const |
Information about the unit -- a detailed description of it. | |
int | hitpoints () const |
int | max_hitpoints () const |
int | experience () const |
int | max_experience () const |
int | level () const |
bool | get_experience (int xp) |
Adds 'xp' points to the units experience; returns true if advancement should occur. | |
SDL_Colour | hp_color () const |
Colors for the unit's hitpoints. | |
SDL_Colour | xp_color () const |
Colors for the unit's XP. | |
bool | unrenamable () const |
Set to true for some scenario-specific units which should not be renamed. | |
unsigned int | side () const |
Uint32 | team_rgb () const |
const std::string & | team_color () const |
unit_race::GENDER | gender () const |
void | set_side (unsigned int new_side) |
fixed_t | alpha () const |
bool | can_recruit () const |
bool | incapacitated () const |
const std::vector< std::string > & | recruits () const |
int | total_movement () const |
int | movement_left () const |
void | set_hold_position (bool value) |
bool | hold_position () const |
void | set_user_end_turn (bool value=true) |
bool | user_end_turn () const |
int | attacks_left () const |
void | set_movement (int moves) |
void | set_attacks (int left) |
void | unit_hold_position () |
void | new_turn () |
void | end_turn () |
void | new_level () |
void | refresh (const game_display &disp, const gamemap::location &loc) |
Called on every draw. | |
bool | take_hit (int damage) |
void | heal (int amount) |
void | heal_all () |
bool | resting () const |
void | set_resting (bool rest) |
const std::string | get_state (const std::string &state) const |
void | set_state (const std::string &state, const std::string &value) |
bool | has_moved () const |
bool | has_goto () const |
int | emits_zoc () const |
bool | matches_filter (const vconfig &cfg, const gamemap::location &loc, bool use_flat_tod=false) const |
void | add_overlay (const std::string &overlay) |
void | remove_overlay (const std::string &overlay) |
const std::vector< std::string > & | overlays () const |
void | read (const config &cfg, bool use_traits=true, game_state *state=0) |
Initialize this unit from a cfg object. | |
void | write (config &cfg) const |
void | assign_role (const std::string &role) |
void | assign_ai_special (const std::string &s) |
std::string | get_ai_special () const |
const std::vector< attack_type > & | attacks () const |
std::vector< attack_type > & | attacks () |
int | damage_from (const attack_type &attack, bool attacker, const gamemap::location &loc) const |
const surface | still_image (bool scaled=false) const |
A SDL surface, ready for display for place where we need a still-image of the unit. | |
void | redraw_unit (game_display &disp, const gamemap::location &loc, const bool fake=false) |
draw a unit, fake is used for temporary unit not in unit_map (so we can skip functions assuming that) | |
void | clear_haloes () |
Clear unit_halo_ and unit_anim_halo_. | |
void | set_standing (const gamemap::location &loc, bool with_bars=true) |
void | set_idling (const game_display &disp, const gamemap::location &loc) |
void | set_selecting (const game_display &disp, const gamemap::location &loc) |
unit_animation * | get_animation () |
const unit_animation * | get_animation () const |
void | set_facing (gamemap::location::DIRECTION dir) |
gamemap::location::DIRECTION | facing () const |
std::set< gamemap::location > | overlaps (const gamemap::location &loc) const |
const t_string & | traits_description () const |
int | cost () const |
const gamemap::location & | get_goto () const |
void | set_goto (const gamemap::location &new_goto) |
int | upkeep () const |
void | set_hidden (bool state) |
bool | get_hidden () |
bool | is_flying () const |
bool | is_fearless () const |
bool | is_healthy () const |
int | movement_cost (const t_translation::t_terrain terrain) const |
int | defense_modifier (t_translation::t_terrain terrain, int recurse_count=0) const |
int | resistance_against (const std::string &damage_name, bool attacker, const gamemap::location &loc) const |
int | resistance_against (const attack_type &damage_type, bool attacker, const gamemap::location &loc) const |
string_map | get_base_resistances () 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 |
config::child_list | get_modification_advances () const |
const config::child_list & | modification_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) |
const t_string & | modification_description (const std::string &type) const |
bool | move_interrupted () const |
const gamemap::location & | get_interrupted_move () const |
void | set_interrupted_move (const gamemap::location &interrupted_move) |
void | start_animation (const int start_time, const gamemap::location &loc, const unit_animation *animation, bool with_bars, bool cycles=false, const std::string text="", const Uint32 text_color=0, STATE state=STATE_ANIM) |
normal anims | |
const std::string & | absolute_image () const |
The name of the file to game_display (used in menus). | |
const std::string & | image_halo () const |
const std::string & | get_hit_sound () const |
const std::string & | image_ellipse () const |
const std::string & | usage () const |
unit_type::ALIGNMENT | alignment () const |
const unit_race * | race () const |
const unit_animation * | choose_animation (const game_display &disp, const gamemap::location &loc, const std::string &event, const int damage=0, const unit_animation::hit_type hit_type=unit_animation::INVALID, const attack_type *attack=NULL, const attack_type *second_attack=NULL, int swing_num=0) const |
bool | get_ability_bool (const std::string &ability, const gamemap::location &loc) const |
unit_ability_list | get_abilities (const std::string &ability, const gamemap::location &loc) const |
std::vector< std::string > | ability_tooltips (const gamemap::location &loc) const |
std::vector< std::string > | unit_ability_tooltips () const |
bool | has_ability_type (const std::string &ability) const |
bool | abilities_affects_adjacent () const |
const game_logic::map_formula_callable_ptr & | formula_vars () const |
bool | has_formula () const |
const std::string & | get_formula () const |
void | reset_modifications () |
void | backup_state () |
void | apply_modifications () |
void | remove_temporary_modifications () |
void | add_trait (std::string) |
void | generate_traits (bool musthaveonly=false, game_state *state=0) |
void | generate_traits_description () |
std::string | generate_name (simple_rng *rng=0) const |
bool | invisible (const gamemap::location &loc, const unit_map &units, const std::vector< team > &teams, bool see_all=true) const |
unit_race::GENDER | generate_gender (const unit_type &type, bool gen, game_state *state=0) |
std::string | image_mods () const |
Static Public Member Functions | |
static void | clear_status_caches () |
Clear the unit status cache for all units. | |
Private Member Functions | |
bool | internal_matches_filter (const vconfig &cfg, const gamemap::location &loc, bool use_flat_tod) const |
bool | ability_active (const std::string &ability, const config &cfg, const gamemap::location &loc) const |
bool | ability_affects_adjacent (const std::string &ability, const config &cfg, int dir, const gamemap::location &loc) const |
bool | ability_affects_self (const std::string &ability, const config &cfg, const gamemap::location &loc) const |
bool | resistance_filter_matches (const config &cfg, bool attacker, const std::string &damage_name) const |
bool | resistance_filter_matches (const config &cfg, bool attacker, const attack_type &damage_type) const |
int | movement_cost_internal (t_translation::t_terrain terrain, int recurse_count=0) const |
bool | has_ability_by_id (const std::string &ability) const |
void | remove_ability_by_id (const std::string &ability) |
void | set_underlying_id () |
void | clear_visibility_cache () const |
Clears the cache. | |
Private Attributes | |
config | cfg_ |
config | movement_b_ |
config | defense_b_ |
config | resistance_b_ |
config | abilities_b_ |
std::vector< std::string > | advances_to_ |
std::string | type_ |
const unit_race * | race_ |
std::string | id_ |
std::string | name_ |
std::string | underlying_id_ |
t_string | type_name_ |
std::string | undead_variation_ |
std::string | variation_ |
int | hit_points_ |
int | max_hit_points_ |
int | max_hit_points_b_ |
int | experience_ |
int | max_experience_ |
int | max_experience_b_ |
int | level_ |
unit_type::ALIGNMENT | alignment_ |
std::string | flag_rgb_ |
std::string | image_mods_ |
bool | unrenamable_ |
unsigned int | side_ |
unit_race::GENDER | gender_ |
fixed_t | alpha_ |
std::string | unit_formula_ |
game_logic::map_formula_callable_ptr | formula_vars_ |
std::vector< std::string > | recruits_ |
int | movement_ |
int | max_movement_ |
int | max_movement_b_ |
std::map < t_translation::t_terrain, int > | movement_costs_ |
std::map < t_translation::t_terrain, int > | defense_mods_ |
bool | hold_position_ |
bool | end_turn_ |
bool | resting_ |
int | attacks_left_ |
int | max_attacks_ |
std::map< std::string, std::string > | states_ |
config | variables_ |
int | emit_zoc_ |
STATE | state_ |
std::vector< std::string > | overlays_ |
std::string | role_ |
std::string | ai_special_ |
std::vector< attack_type > | attacks_ |
std::vector< attack_type > | attacks_b_ |
gamemap::location::DIRECTION | facing_ |
t_string | traits_description_ |
int | unit_value_ |
gamemap::location | goto_ |
gamemap::location | interrupted_move_ |
bool | flying_ |
bool | is_fearless_ |
bool | is_healthy_ |
string_map | modification_descriptions_ |
std::vector< unit_animation > | animations_ |
unit_animation * | anim_ |
int | next_idling_ |
int | frame_begin_time_ |
int | unit_halo_ |
int | unit_anim_halo_ |
bool | getsHit_ |
bool | refreshing_ |
bool | hidden_ |
bool | draw_bars_ |
config | modifications_ |
const unit_map * | units_ |
const gamemap * | map_ |
const gamestatus * | gamestatus_ |
const std::vector< team > * | teams_ |
std::map< gamemap::location, bool > | invisibility_cache_ |
Hold the visibility status cache for a unit, mutable since it's a cache. | |
Friends | |
struct | unit_movement_resetter |
void | attack_type::set_specials_context (const gamemap::location &loc, const gamemap::location &, const unit &un, bool) const |
Definition at line 50 of file unit.hpp.
enum unit::STATE |
unit::unit | ( | const unit & | u | ) |
Definition at line 90 of file unit.cpp.
References next_idling_, halo::NO_HALO, unit_anim_halo_, and unit_halo_.
Referenced by operator=().
unit::unit | ( | const config & | cfg, | |
bool | use_traits = false | |||
) |
unit::unit | ( | unit_map * | unitmap, | |
const gamemap * | map, | |||
const gamestatus * | game_status, | |||
const std::vector< team > * | teams, | |||
const config & | cfg, | |||
bool | use_traits = false , |
|||
game_state * | state = 0 | |||
) |
Definition at line 186 of file unit.cpp.
References game_config::add_color_info(), end_turn_, getsHit_, hidden_, read(), and refreshing_.
unit::unit | ( | const unit_type * | t, | |
int | side, | |||
bool | use_traits = false , |
|||
bool | dummy_unit = false , |
|||
unit_race::GENDER | gender = unit_race::MALE , |
|||
std::string | variation = "" | |||
) |
Initializes a unit from a unit type.
Definition at line 290 of file unit.cpp.
References advance_to(), anim_, apply_modifications(), attacks_left_, cfg_, end_turn_, experience_, frame_begin_time_, gender_, generate_name(), generate_traits(), unit_type::get_gender_unit_type(), getsHit_, goto_, hold_position_, movement_, name_, next_idling_, set_underlying_id(), side_, unrenamable_, and validate_side().
unit::unit | ( | unit_map * | unitmap, | |
const gamemap * | map, | |||
const gamestatus * | game_status, | |||
const std::vector< team > * | teams, | |||
const unit_type * | t, | |||
int | side, | |||
bool | use_traits = false , |
|||
bool | dummy_unit = false , |
|||
unit_race::GENDER | gender = unit_race::MALE , |
|||
std::string | variation = "" | |||
) |
Definition at line 255 of file unit.cpp.
References advance_to(), anim_, apply_modifications(), attacks_left_, cfg_, end_turn_, experience_, frame_begin_time_, gender_, generate_name(), generate_traits(), unit_type::get_gender_unit_type(), getsHit_, goto_, hold_position_, movement_, name_, next_idling_, halo::NO_HALO, set_underlying_id(), side_, unit_anim_halo_, unit_halo_, unrenamable_, and validate_side().
unit::~unit | ( | ) | [virtual] |
Definition at line 322 of file unit.cpp.
References anim_, clear_haloes(), and units_with_cache.
Referenced by operator=().
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 228 of file unit.cpp.
References units_with_cache.
Referenced by do_replay_handle(), move_unit(), game_events::pump(), events::menu_handler::redo(), and events::menu_handler::undo().
void unit::set_game_context | ( | unit_map * | unitmap, | |
const gamemap * | map, | |||
const gamestatus * | game_status, | |||
const std::vector< team > * | teams | |||
) |
Definition at line 351 of file unit.cpp.
References game_events::add_events(), cfg_, gamestatus_, config::get_children(), map_, teams_, type_, and units_.
Referenced by get_player_info(), events::menu_handler::recall(), and events::menu_handler::redo().
void unit::advance_to | ( | const unit_type * | t, | |
bool | use_traits = false , |
|||
game_state * | state = 0 | |||
) |
Advances this unit to another type.
Definition at line 467 of file unit.cpp.
References game_events::add_events(), unit_type::advances_to(), advances_to_, unit_type::alignment(), alignment_, unit_type::alpha(), alpha_, unit_type::animations(), animations_, apply_modifications(), unit_type::attacks(), attacks_, backup_state(), unit_type::cfg_, cfg_, config::clear_children(), unit_type::cost(), defense_mods_, emit_zoc_, end_turn_, unit_type::experience_needed(), unit_type::flag_rgb(), flag_rgb_, flying_, gender_, gender_string(), generate_gender(), generate_traits(), unit_movement_type::get_cfg(), config::get_children(), unit_type::get_gender_unit_type(), unit_movement_type::get_parent(), unit_type::get_variation(), heal_all(), hidden_, hit_points_, unit_type::hitpoints(), unit_type::id(), unit_movement_type::is_flying(), unit_type::level(), level_, max_attacks_, max_experience_, max_hit_points_, max_movement_, config::merge_with(), unit_type::movement(), movement_costs_, unit_type::movement_type(), profile(), unit_type::race_, race_, refreshing_, reset_modifications(), set_state(), utils::string_bool(), type(), type_, type_id(), unit_type::type_name(), type_name_, unit_type::undead_variation(), undead_variation_, unit_type::unit_description(), unit_value_, and variation_.
Referenced by add_modification(), get_advanced_unit(), read(), and unit().
const std::vector<std::string> unit::advances_to | ( | ) | const [inline] |
Definition at line 77 of file unit.hpp.
References advances_to_.
Referenced by advancement_icons(), and xp_color().
const std::string& unit::type_id | ( | ) | const [inline] |
The type id of the unit.
Definition at line 80 of file unit.hpp.
References type_.
Referenced by add_modification(), advance_to(), statistics::advance_unit(), advance_unit(), ai::analyze_potential_recruit_combat(), attack::attack(), ai::desperate_attack(), generate_traits(), unit_callable::get_value(), internal_matches_filter(), statistics::recall_unit(), statistics::recruit_unit(), recruit_unit(), events::menu_handler::redo(), dialogs::show_unit_description(), type(), statistics::un_recall_unit(), statistics::un_recruit_unit(), battle_context::unit_stats::unit_stats(), and write().
const unit_type * unit::type | ( | ) | const |
Definition at line 572 of file unit.cpp.
References boost::foreach_detail_::end(), lg::engine, lg::err, LOG_STREAM, type_id(), and unit_type_data::types().
Referenced by advance_to(), generate_traits(), internal_matches_filter(), events::menu_handler::redo(), set_underlying_id(), dialogs::show_unit_description(), and events::menu_handler::undo().
const std::string& unit::id | ( | ) | const [inline] |
The unique internal ID of the unit.
Definition at line 84 of file unit.hpp.
References id_, and type_name().
Referenced by unit_callable::get_value(), and set_underlying_id().
const std::string& unit::underlying_id | ( | ) | const [inline] |
Definition at line 85 of file unit.hpp.
References underlying_id_.
Referenced by dfool::unit_memory::add_unit_sighting(), internal_matches_filter(), and game_events::entity_location::matches_unit().
const t_string& unit::type_name | ( | ) | const [inline] |
The unit type name.
Definition at line 88 of file unit.hpp.
References type_name_.
Referenced by dialogs::advance_unit(), dialogs::units_list_preview_pane::get_details(), and id().
const std::string& unit::undead_variation | ( | ) | const [inline] |
Definition at line 89 of file unit.hpp.
References undead_variation_.
Referenced by battle_context::unit_stats::unit_stats().
const std::string& unit::name | ( | ) | const [inline] |
Definition at line 92 of file unit.hpp.
References name_.
Referenced by ability_tooltips(), apply_modifications(), dialogs::units_list_preview_pane::get_details(), and unit_ability_tooltips().
void unit::rename | ( | const std::string & | name | ) | [inline] |
const std::string & unit::profile | ( | ) | const |
The unit's profile.
Definition at line 585 of file unit.cpp.
References absolute_image(), and cfg_.
Referenced by advance_to().
const std::string& unit::unit_description | ( | ) | const [inline] |
int unit::hitpoints | ( | ) | const [inline] |
Definition at line 100 of file unit.hpp.
References hit_points_.
Referenced by ai::analyze_potential_recruit_combat(), ai::choose_move(), ai::desperate_attack(), dialogs::units_list_preview_pane::get_details(), ai::get_healing(), unit_callable::get_value(), hp_color(), ai::power_projection(), ai::rate_group(), redraw_unit(), and battle_context::unit_stats::unit_stats().
int unit::max_hitpoints | ( | ) | const [inline] |
Definition at line 101 of file unit.hpp.
References max_hit_points_.
Referenced by ai::analyze_potential_recruit_combat(), dialogs::units_list_preview_pane::get_details(), ai::get_healing(), unit_callable::get_value(), heal(), heal_all(), hp_color(), ai::power_projection(), ai::rate_group(), redraw_unit(), and battle_context::unit_stats::unit_stats().
int unit::experience | ( | ) | const [inline] |
Definition at line 102 of file unit.hpp.
References experience_.
Referenced by events::delete_recall_unit::button_pressed(), compare_unit_values(), dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), redraw_unit(), and xp_color().
int unit::max_experience | ( | ) | const [inline] |
Definition at line 103 of file unit.hpp.
References unit_type::experience_accelerator::get_acceleration(), and max_experience_.
Referenced by advances(), dialogs::animate_unit_advancement(), events::delete_recall_unit::button_pressed(), compare_unit_values(), get_advanced_unit(), dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), redraw_unit(), and xp_color().
int unit::level | ( | ) | const [inline] |
Definition at line 104 of file unit.hpp.
References level_.
Referenced by events::delete_recall_unit::button_pressed(), compare_unit_values(), dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), internal_matches_filter(), and upkeep().
bool unit::get_experience | ( | int | xp | ) | [inline] |
Adds 'xp' points to the units experience; returns true if advancement should occur.
Definition at line 109 of file unit.hpp.
References advances(), and experience_.
Referenced by dialogs::animate_unit_advancement(), and get_advanced_unit().
SDL_Colour unit::hp_color | ( | ) | const |
Colors for the unit's hitpoints.
Definition at line 593 of file unit.cpp.
References hitpoints(), and max_hitpoints().
Referenced by dialogs::units_list_preview_pane::get_details(), and redraw_unit().
SDL_Colour unit::xp_color | ( | ) | const |
Colors for the unit's XP.
Definition at line 630 of file unit.cpp.
References advances_to(), experience(), get_modification_advances(), game_config::kill_experience, max_experience(), and size.
Referenced by dialogs::units_list_preview_pane::get_details(), and redraw_unit().
bool unit::unrenamable | ( | ) | const [inline] |
Set to true for some scenario-specific units which should not be renamed.
Definition at line 115 of file unit.hpp.
References unrenamable_.
unsigned int unit::side | ( | ) | const [inline] |
Definition at line 116 of file unit.hpp.
References side_.
Referenced by statistics::advance_unit(), shortest_path_calculator::cost(), find_routes(), get_abilities(), get_ability_bool(), ai::get_healing(), get_player_info(), unit_callable::get_value(), image_mods(), internal_matches_filter(), unit_display::move_unit(), statistics::recall_unit(), statistics::recruit_unit(), redraw_unit(), route_turns_to_complete(), team_rgb(), statistics::un_recall_unit(), statistics::un_recruit_unit(), and unit_display::unit_visible_on_path().
Uint32 unit::team_rgb | ( | ) | const [inline] |
const std::string& unit::team_color | ( | ) | const [inline] |
unit_race::GENDER unit::gender | ( | ) | const [inline] |
Definition at line 119 of file unit.hpp.
References gender_.
Referenced by add_modification(), events::delete_recall_unit::button_pressed(), and internal_matches_filter().
void unit::set_side | ( | unsigned int | new_side | ) | [inline] |
bool unit::can_recruit | ( | ) | const [inline] |
Definition at line 123 of file unit.hpp.
References cfg_, and utils::string_bool().
Referenced by generate_traits(), unit_callable::get_value(), internal_matches_filter(), redraw_unit(), upkeep(), and write().
bool unit::incapacitated | ( | ) | const [inline] |
Definition at line 124 of file unit.hpp.
References get_state(), and utils::string_bool().
Referenced by attacks_left(), emits_zoc(), movement_left(), and refresh().
const std::vector<std::string>& unit::recruits | ( | ) | const [inline] |
int unit::total_movement | ( | ) | const [inline] |
Definition at line 126 of file unit.hpp.
References max_movement_.
Referenced by end_turn(), find_routes(), dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), has_moved(), new_turn(), recruit_unit(), redraw_unit(), route_turns_to_complete(), and unit_movement_resetter::unit_movement_resetter().
int unit::movement_left | ( | ) | const [inline] |
Definition at line 127 of file unit.hpp.
References incapacitated(), and movement_.
Referenced by dialogs::units_list_preview_pane::get_details(), unit_callable::get_value(), has_moved(), move_interrupted(), redraw_unit(), and route_turns_to_complete().
void unit::set_hold_position | ( | bool | value | ) | [inline] |
bool unit::hold_position | ( | ) | const [inline] |
void unit::set_user_end_turn | ( | bool | value = true |
) | [inline] |
bool unit::user_end_turn | ( | ) | const [inline] |
int unit::attacks_left | ( | ) | const [inline] |
void unit::set_movement | ( | int | moves | ) |
Definition at line 667 of file unit.cpp.
References end_turn_, hold_position_, max_movement_, and movement_.
Referenced by ai::multistep_move_possible(), and recruit_unit().
void unit::set_attacks | ( | int | left | ) | [inline] |
Definition at line 134 of file unit.hpp.
References attacks_left_, and max_attacks_.
Referenced by attack::attack(), and recruit_unit().
void unit::unit_hold_position | ( | ) | [inline] |
void unit::new_turn | ( | ) |
Definition at line 674 of file unit.cpp.
References attacks_left_, end_turn_, hold_position_, max_attacks_, movement_, set_state(), and total_movement().
Referenced by events::menu_handler::create_unit().
void unit::end_turn | ( | ) |
Definition at line 685 of file unit.cpp.
References attacks_left_, get_state(), is_healthy_, max_attacks_, movement_, resting_, set_interrupted_move(), set_state(), utils::string_bool(), and total_movement().
void unit::new_level | ( | ) |
Definition at line 695 of file unit.cpp.
References ai_special_, apply_modifications(), goto_, heal_all(), remove_temporary_modifications(), role_, and set_state().
void unit::refresh | ( | const game_display & | disp, | |
const gamemap::location & | loc | |||
) | [inline] |
Called on every draw.
Definition at line 140 of file unit.hpp.
References anim_, unit_animation::animation_finished_potential(), get_current_animation_tick(), incapacitated(), next_idling_, set_idling(), set_standing(), state_, STATE_FORGET, and STATE_STANDING.
Referenced by game_display::invalidate_animations().
bool unit::take_hit | ( | int | damage | ) | [inline] |
void unit::heal | ( | int | amount | ) |
void unit::heal_all | ( | ) | [inline] |
Definition at line 155 of file unit.hpp.
References hit_points_, and max_hitpoints().
Referenced by add_modification(), advance_to(), attack::attack(), new_level(), and recruit_unit().
void unit::set_resting | ( | bool | rest | ) | [inline] |
const std::string unit::get_state | ( | const std::string & | state | ) | const |
Definition at line 741 of file unit.cpp.
References states_.
Referenced by end_turn(), incapacitated(), invisible(), movement_cost(), overlaps(), redraw_unit(), and battle_context::unit_stats::unit_stats().
void unit::set_state | ( | const std::string & | state, | |
const std::string & | value | |||
) |
Definition at line 749 of file unit.cpp.
References states_.
Referenced by add_modification(), advance_to(), end_turn(), new_level(), new_turn(), and read().
bool unit::has_moved | ( | ) | const [inline] |
bool unit::has_goto | ( | ) | const [inline] |
int unit::emits_zoc | ( | ) | const [inline] |
bool unit::matches_filter | ( | const vconfig & | cfg, | |
const gamemap::location & | loc, | |||
bool | use_flat_tod = false | |||
) | const |
Definition at line 792 of file unit.cpp.
References cond, vconfig::all_children_iterator::get_child(), vconfig::all_children_iterator::get_key(), internal_matches_filter(), vconfig::ordered_begin(), vconfig::ordered_end(), units_, gamemap::location::valid(), gamemap::location::x, and gamemap::location::y.
Referenced by ability_active(), ability_affects_adjacent(), ability_affects_self(), unit_animation::matches(), and game_events::unit_matches_filter().
void unit::add_overlay | ( | const std::string & | overlay | ) | [inline] |
void unit::remove_overlay | ( | const std::string & | overlay | ) | [inline] |
const std::vector<std::string>& unit::overlays | ( | ) | const [inline] |
void unit::read | ( | const config & | cfg, | |
bool | use_traits = true , |
|||
game_state * | state = 0 | |||
) |
Initialize this unit from a cfg object.
cfg | Configuration object from which to read the unit. | |
use_traits | ?? |
Definition at line 1150 of file unit.cpp.
References _, game_events::add_events(), advance_to(), advances_to_, ai_special_, alignment_, alpha_, animations_, attacks_left_, cfg_, unit_type::CHAOTIC, config::clear(), config::clear_children(), emit_zoc_, boost::foreach_detail_::end(), lg::engine, lg::err, experience_, facing_, unit_animation::fill_initial_animations(), flag_rgb_, flying_, formula_vars_, gender_, generate_gender(), generate_name(), config::get_children(), goto_, hit_points_, id_, utils::interpolate_variables_into_string(), unit_type::LAWFUL, level_, LOG_STREAM, max_attacks_, max_experience_, max_hit_points_, max_movement_, modifications_, movement_, name_, gamemap::location::NDIRECTIONS, unit_type::NEUTRAL, overlays_, gamemap::location::parse_direction(), race_, recruits_, config::remove_child(), resting_, game_state::rng(), role_, variant::serialize_from_string(), set_state(), set_underlying_id(), side_, gamemap::location::SOUTH_EAST, utils::split(), states_, utils::string_bool(), string_gender(), type_, type_name_, unit_type_data::types(), undead_variation_, underlying_id_, unit_formula_, unit_value_, unrenamable_, validate_side(), config::values, variables_, variation_, gamemap::location::x, and gamemap::location::y.
Referenced by unit().
void unit::write | ( | config & | cfg | ) | const |
Definition at line 1378 of file unit.cpp.
References abilities_b_, config::add_child(), advances_to_, ai_special_, alignment_, alpha_, config::append(), attacks_b_, attacks_left_, can_recruit(), cfg_, unit_type::CHAOTIC, config::child(), config::clear(), config::clear_children(), defense_b_, emit_zoc_, boost::foreach_detail_::end(), experience_, facing_, flag_rgb_, flying_, formula_vars_, gender_, gender_string(), unit_type::get_gender_unit_type(), unit_type::get_variation(), goto_, has_formula(), hit_points_, unit_race::id(), utils::join(), unit_type::LAWFUL, level_, max_attacks_, max_experience_b_, max_hit_points_b_, max_movement_b_, modifications_, movement_, movement_b_, name_, unit_type::NEUTRAL, overlays_, race_, recruits_, resistance_b_, resting_, role_, side_, states_, type_id(), type_name_, unit_type_data::types(), undead_variation_, underlying_id_, unit_type::unit_description(), unit_formula_, unit_value_, unrenamable_, variables_, variation_, gamemap::location::write_direction(), gamemap::location::x, and gamemap::location::y.
Referenced by get_checksum(), internal_matches_filter(), and recruit_unit().
void unit::assign_role | ( | const std::string & | role | ) | [inline] |
void unit::assign_ai_special | ( | const std::string & | s | ) | [inline] |
std::string unit::get_ai_special | ( | ) | const [inline] |
const std::vector<attack_type>& unit::attacks | ( | ) | const [inline] |
Definition at line 184 of file unit.hpp.
References attacks_.
Referenced by battle_context::battle_context(), battle_context::choose_attacker_weapon(), battle_context::choose_defender_weapon(), ai::desperate_attack(), get_checksum(), dialogs::units_list_preview_pane::get_details(), internal_matches_filter(), ai::power_projection(), ai::rate_group(), and battle_context::unit_stats::unit_stats().
std::vector<attack_type>& unit::attacks | ( | ) | [inline] |
int unit::damage_from | ( | const attack_type & | attack, | |
bool | attacker, | |||
const gamemap::location & | loc | |||
) | const [inline] |
Definition at line 187 of file unit.hpp.
References resistance_against().
Referenced by battle_context::unit_stats::unit_stats().
const surface unit::still_image | ( | bool | scaled = false |
) | const |
A SDL surface, ready for display for place where we need a still-image of the unit.
Definition at line 1522 of file unit.cpp.
References absolute_image(), image::get_image(), image_mods(), image::SCALED_TO_ZOOM, and image::UNSCALED.
Referenced by dialogs::units_list_preview_pane::get_details(), and redraw_unit().
void unit::redraw_unit | ( | game_display & | disp, | |
const gamemap::location & | loc, | |||
const bool | fake = false | |||
) |
draw a unit, fake is used for temporary unit not in unit_map (so we can skip functions assuming that)
Definition at line 1605 of file unit.cpp.
References absolute_image(), halo::add(), game_config::ally_ball_image, anim_, surface::assign(), boost::foreach_detail_::begin(), frame_parameters::blend_ratio, frame_parameters::blend_with, buf, can_advance(), can_recruit(), clear_haloes(), game_display::draw_bar(), draw_bars_, display::drawing_buffer_add(), game_config::enemy_ball_image, game_config::energy_image, experience(), facing_, game_display::float_label(), display::fogged(), frame_begin_time_, ftofxp, unit_animation::get_current_frame_begin_time(), unit_animation::get_current_params(), gamemap::location::get_direction(), gamemap::get_drawing_order(), image::locator::get_filename(), image::get_image(), display::get_location_x(), display::get_location_y(), display::get_map(), team::get_side_colour_index(), game_display::get_singleton(), get_state(), game_display::get_teams(), gamemap::get_terrain(), gamemap::get_terrain_info(), game_display::get_units(), display::get_zoom_factor(), frame_parameters::halo, frame_parameters::halo_x, frame_parameters::halo_y, display::hex_size(), hidden_, frame_parameters::highlight_ratio, hitpoints(), game_config::hp_bar_scaling, hp_color(), halo::HREVERSE, frame_parameters::image, frame_parameters::image_diagonal, image_ellipse(), image_halo(), frame_parameters::image_mod, image_mods(), invisible(), is_flying(), image::locator::is_void(), display::LAYER_UNIT_BAR, display::LAYER_UNIT_BG, display::LAYER_UNIT_FG, level_, map, display::map_outside_area(), max_experience(), max_hitpoints(), display::mouseover_hex(), game_config::moved_ball_image, movement_left(), halo::NO_HALO, halo::NORMAL, gamemap::location::NORTH, gamemap::location::NORTH_WEST, surface::null(), frame_parameters::offset, overlays(), game_config::partmoved_ball_image, sound::play_sound(), game_display::playing_team(), rects_overlap(), unit_animation::redraw(), refreshing_, halo::remove(), display::render_unit_image(), display::rgb(), image::SCALED_TO_ZOOM, display::selected_hex(), halo::set_location(), set_standing(), preferences::show_side_colours(), side(), side_, frame_parameters::sound, gamemap::location::SOUTH, gamemap::location::SOUTH_WEST, still_image(), utils::string_bool(), frame_parameters::submerge, game_display::team_valid(), frame_parameters::text, frame_parameters::text_color, total_movement(), unit_anim_halo_, unit_can_move(), unit_halo_, terrain_type::unit_height_adjust(), terrain_type::unit_submerge(), game_config::unmoved_ball_image, unit_animation::update_last_draw_time(), user_end_turn(), gamemap::location::valid(), game_display::viewing_team(), frame_parameters::x, game_config::xp_bar_scaling, xp_color(), and frame_parameters::y.
Referenced by game_display::draw().
void unit::clear_haloes | ( | ) |
Clear unit_halo_ and unit_anim_halo_.
Definition at line 1870 of file unit.cpp.
References halo::NO_HALO, halo::remove(), unit_anim_halo_, and unit_halo_.
Referenced by redraw_unit(), game_display::remove_temporary_unit(), set_hidden(), and ~unit().
void unit::set_standing | ( | const gamemap::location & | loc, | |
bool | with_bars = true | |||
) |
Definition at line 1541 of file unit.cpp.
References choose_animation(), preferences::disp, get_adjacent_tiles(), game_display::get_singleton(), game_display::invalidate(), preferences::show_standing_animations(), start_animation(), and STATE_STANDING.
Referenced by unit_display::move_unit(), redraw_unit(), refresh(), start_animation(), teleport_unit_between(), and unit_display::unit_healing().
void unit::set_idling | ( | const game_display & | disp, | |
const gamemap::location & | loc | |||
) |
Definition at line 1559 of file unit.cpp.
References choose_animation(), start_animation(), and STATE_FORGET.
Referenced by refresh().
void unit::set_selecting | ( | const game_display & | disp, | |
const gamemap::location & | loc | |||
) |
Definition at line 1564 of file unit.cpp.
References choose_animation(), preferences::show_standing_animations(), start_animation(), STATE_FORGET, and STATE_STANDING.
unit_animation* unit::get_animation | ( | ) | [inline] |
Definition at line 203 of file unit.hpp.
References anim_.
Referenced by game_display::invalidate_animations(), overlaps(), and unit_animator::replace_anim_if_invalid().
const unit_animation* unit::get_animation | ( | ) | const [inline] |
void unit::set_facing | ( | gamemap::location::DIRECTION | dir | ) |
Definition at line 1598 of file unit.cpp.
References facing_, and gamemap::location::NDIRECTIONS.
Referenced by unit_display::move_unit(), and move_unit_between().
gamemap::location::DIRECTION unit::facing | ( | ) | const [inline] |
Definition at line 206 of file unit.hpp.
References facing_.
Referenced by unit_animation::matches(), and unit_display::unit_die().
std::set< gamemap::location > unit::overlaps | ( | const gamemap::location & | loc | ) | const |
Definition at line 1882 of file unit.cpp.
References abilities_affects_adjacent(), anim_, frame_parameters::blend_ratio, frame_parameters::blend_with, preferences::disp, facing_, get_adjacent_tiles(), get_animation(), unit_animation::get_current_params(), gamemap::location::get_direction(), display::get_map(), gamemap::location::get_opposite_dir(), game_display::get_singleton(), get_state(), game_display::get_teams(), gamemap::get_terrain(), gamemap::get_terrain_info(), game_display::get_units(), display::get_zoom_factor(), frame_parameters::halo_y, frame_parameters::highlight_ratio, frame_parameters::image_mod, image_mods(), unit_animation::invalidate(), invisible(), is_flying(), map, frame_parameters::offset, display::rgb(), display::selected_hex(), utils::string_bool(), frame_parameters::submerge, terrain_type::unit_height_adjust(), terrain_type::unit_submerge(), and frame_parameters::y.
Referenced by game_display::invalidate().
const t_string& unit::traits_description | ( | ) | const [inline] |
Definition at line 209 of file unit.hpp.
References traits_description_.
Referenced by dialogs::units_list_preview_pane::get_details().
int unit::cost | ( | ) | const [inline] |
Definition at line 211 of file unit.hpp.
References unit_value_.
Referenced by ai::analyze_potential_recruit_combat(), unit_callable::get_value(), statistics::recall_unit(), statistics::recruit_unit(), statistics::un_recall_unit(), and statistics::un_recruit_unit().
const gamemap::location& unit::get_goto | ( | ) | const [inline] |
void unit::set_goto | ( | const gamemap::location & | new_goto | ) | [inline] |
int unit::upkeep | ( | ) | const |
Definition at line 1942 of file unit.cpp.
References can_recruit(), cfg_, and level().
Referenced by events::delete_recall_unit::button_pressed().
void unit::set_hidden | ( | bool | state | ) |
Definition at line 2948 of file unit.cpp.
References clear_haloes(), and hidden_.
Referenced by unit_display::move_unit().
bool unit::get_hidden | ( | ) | [inline] |
Definition at line 219 of file unit.hpp.
References hidden_.
Referenced by unit_display::move_unit().
bool unit::is_flying | ( | ) | const [inline] |
Definition at line 220 of file unit.hpp.
References flying_.
Referenced by overlaps(), and redraw_unit().
bool unit::is_fearless | ( | ) | const [inline] |
Definition at line 221 of file unit.hpp.
References is_fearless_.
Referenced by battle_context::unit_stats::unit_stats().
bool unit::is_healthy | ( | ) | const [inline] |
int unit::movement_cost | ( | const t_translation::t_terrain | terrain | ) | const |
Definition at line 2025 of file unit.cpp.
References get_state(), movement_cost_internal(), and utils::string_bool().
Referenced by emergency_path_calculator::cost(), shortest_path_calculator::cost(), move_cost_calculator::cost(), find_routes(), internal_matches_filter(), and route_turns_to_complete().
int unit::defense_modifier | ( | t_translation::t_terrain | terrain, | |
int | recurse_count = 0 | |||
) | const |
Definition at line 2034 of file unit.cpp.
References cfg_, config::child(), defense_mods_, lg::err, ERR_CONFIG, gamemap::get_terrain_info(), LOG_STREAM, map_, t_translation::MINUS, t_translation::PLUS, gamemap::underlying_def_terrain(), value, and t_translation::write_terrain_code().
Referenced by ai::choose_move(), shortest_path_calculator::cost(), internal_matches_filter(), ai::power_projection(), ai::rate_group(), ai::rate_terrain(), and battle_context::unit_stats::unit_stats().
int unit::resistance_against | ( | const std::string & | damage_name, | |
bool | attacker, | |||
const gamemap::location & | loc | |||
) | const |
Definition at line 2126 of file unit.cpp.
References cfg_, unit_ability_list::cfgs, config::child(), unit_ability_list::empty(), get_abilities(), unit_abilities::effect::get_composite_value(), unit_ability_list::highest(), and resistance_filter_matches().
Referenced by damage_from(), and resistance_against().
int unit::resistance_against | ( | const attack_type & | damage_type, | |
bool | attacker, | |||
const gamemap::location & | loc | |||
) | const [inline] |
string_map unit::get_base_resistances | ( | ) | const |
bool unit::can_advance | ( | ) | const [inline] |
Definition at line 233 of file unit.hpp.
References advances_to_, and get_modification_advances().
Referenced by advancement_icons(), advances(), and redraw_unit().
bool unit::advances | ( | ) | const [inline] |
Definition at line 234 of file unit.hpp.
References can_advance(), experience_, and max_experience().
Referenced by amla_icons(), get_experience(), and get_modification_advances().
std::map< std::string, std::string > unit::advancement_icons | ( | ) | const |
Definition at line 2170 of file unit.cpp.
References advances_to(), advances_to_, can_advance(), get_modification_advances(), and game_config::level_image.
std::vector< std::pair< std::string, std::string > > unit::amla_icons | ( | ) | const |
Definition at line 2202 of file unit.cpp.
References advances(), get_modification_advances(), and modification_count().
config::child_list unit::get_modification_advances | ( | ) | const |
Definition at line 2264 of file unit.cpp.
References advances(), advances_to_, modification_advancements(), modification_count(), utils::split(), and utils::string_bool().
Referenced by advancement_icons(), amla_icons(), can_advance(), and xp_color().
const config::child_list& unit::modification_advancements | ( | ) | const [inline] |
Definition at line 240 of file unit.hpp.
References cfg_, and config::get_children().
Referenced by get_modification_advances().
size_t unit::modification_count | ( | const std::string & | type, | |
const std::string & | id | |||
) | const |
Definition at line 2297 of file unit.cpp.
References config::get_children(), and modifications_.
Referenced by amla_icons(), and get_modification_advances().
void unit::add_modification | ( | const std::string & | type, | |
const config & | modification, | |||
bool | no_add = false | |||
) |
Definition at line 2324 of file unit.cpp.
References _, a, unit_animation::add_anims(), config::add_child(), game_config::add_color_info(), advance_to(), animations_, config::append(), utils::apply_modifier(), attacks_, cfg_, config::child(), config::child_range(), defense_mods_, description, emit_zoc_, t_string::empty(), boost::foreach_detail_::end(), lg::engine, lg::err, gender(), gender_, gender_string(), config::all_children_iterator::get_child(), config::all_children_iterator::get_key(), has_ability_by_id(), heal_all(), hit_points_, image_mods_, utils::interpolate_variables_into_string(), level_, LOG_STREAM, LOG_UT, max_experience_, max_hit_points_, max_movement_, mod_mdr_merge(), modification_descriptions_, modifications_, movement_, movement_costs_, N_, config::ordered_begin(), config::ordered_end(), remove_ability_by_id(), set_state(), utils::split(), utils::string_bool(), type_id(), unit_type_data::types(), variation_, and vgettext().
Referenced by dialogs::animate_unit_advancement(), apply_modifications(), and attack::attack().
const t_string & unit::modification_description | ( | const std::string & | type | ) | const |
bool unit::move_interrupted | ( | ) | const [inline] |
Definition at line 249 of file unit.hpp.
References interrupted_move_, movement_left(), gamemap::location::x, and gamemap::location::y.
const gamemap::location& unit::get_interrupted_move | ( | ) | const [inline] |
void unit::set_interrupted_move | ( | const gamemap::location & | interrupted_move | ) | [inline] |
void unit::start_animation | ( | const int | start_time, | |
const gamemap::location & | loc, | |||
const unit_animation * | animation, | |||
bool | with_bars, | |||
bool | cycles = false , |
|||
const std::string | text = "" , |
|||
const Uint32 | text_color = 0 , |
|||
STATE | state = STATE_ANIM | |||
) |
normal anims
Definition at line 1573 of file unit.cpp.
References anim_, preferences::disp, draw_bars_, facing_, frame_begin_time_, unit_animation::get_begin_time(), get_current_animation_tick(), gamemap::location::get_direction(), game_display::get_singleton(), display::idle_anim(), display::idle_anim_rate(), next_idling_, set_standing(), unit_animation::start_animation(), state_, STATE_FORGET, and STATE_STANDING.
Referenced by set_idling(), set_selecting(), and set_standing().
const std::string& unit::absolute_image | ( | ) | const [inline] |
The name of the file to game_display (used in menus).
Definition at line 261 of file unit.hpp.
References cfg_.
Referenced by dialogs::advance_unit(), profile(), redraw_unit(), and still_image().
const std::string& unit::image_halo | ( | ) | const [inline] |
const std::string& unit::get_hit_sound | ( | ) | const [inline] |
const std::string& unit::image_ellipse | ( | ) | const [inline] |
const std::string& unit::usage | ( | ) | const [inline] |
Definition at line 267 of file unit.hpp.
References cfg_.
Referenced by ai::analyze_potential_recruit_movements().
unit_type::ALIGNMENT unit::alignment | ( | ) | const [inline] |
Definition at line 268 of file unit.hpp.
References alignment_.
Referenced by dialogs::units_list_preview_pane::get_details(), ai::power_projection(), and battle_context::unit_stats::unit_stats().
const unit_race* unit::race | ( | ) | const [inline] |
const unit_animation * unit::choose_animation | ( | const game_display & | disp, | |
const gamemap::location & | loc, | |||
const std::string & | event, | |||
const int | damage = 0 , |
|||
const unit_animation::hit_type | hit_type = unit_animation::INVALID , |
|||
const attack_type * | attack = NULL , |
|||
const attack_type * | second_attack = NULL , |
|||
int | swing_num = 0 | |||
) | const |
Definition at line 2698 of file unit.cpp.
References animations_, and unit_animation::MATCH_FAIL.
Referenced by unit_animator::add_animation(), set_idling(), set_selecting(), and set_standing().
bool unit::get_ability_bool | ( | const std::string & | ability, | |
const gamemap::location & | loc | |||
) | const |
Definition at line 120 of file unit_abilities.cpp.
References ability_active(), ability_affects_adjacent(), ability_affects_self(), unit_abilities::affects_side(), cfg_, config::child(), unit_map::end(), unit_map::find(), get_adjacent_tiles(), config::get_children(), side(), teams_, and units_.
Referenced by shortest_path_calculator::cost(), find_routes(), ai::get_healing(), invisible(), ai::rate_terrain(), and route_turns_to_complete().
unit_ability_list unit::get_abilities | ( | const std::string & | ability, | |
const gamemap::location & | loc | |||
) | const |
Definition at line 156 of file unit_abilities.cpp.
References ability_active(), ability_affects_adjacent(), ability_affects_self(), unit_abilities::affects_side(), cfg_, unit_ability_list::cfgs, config::child(), unit_map::end(), unit_map::find(), get_adjacent_tiles(), config::get_children(), side(), teams_, and units_.
Referenced by resistance_against().
std::vector< std::string > unit::ability_tooltips | ( | const gamemap::location & | loc | ) | const |
Definition at line 226 of file unit_abilities.cpp.
References ability_active(), config::all_children(), cfg_, config::child(), and name().
std::vector< std::string > unit::unit_ability_tooltips | ( | ) | const |
Definition at line 205 of file unit_abilities.cpp.
References config::all_children(), cfg_, config::child(), and name().
Referenced by dialogs::units_list_preview_pane::get_details().
bool unit::has_ability_type | ( | const std::string & | ability | ) | const |
Definition at line 407 of file unit_abilities.cpp.
References cfg_, config::child(), and config::get_children().
bool unit::abilities_affects_adjacent | ( | ) | const |
Definition at line 197 of file unit_abilities.cpp.
References cfg_, and config::child().
Referenced by overlaps().
const game_logic::map_formula_callable_ptr& unit::formula_vars | ( | ) | const [inline] |
Definition at line 280 of file unit.hpp.
References formula_vars_.
Referenced by unit_callable::get_value().
bool unit::has_formula | ( | ) | const [inline] |
const std::string& unit::get_formula | ( | ) | const [inline] |
void unit::reset_modifications | ( | ) |
Definition at line 2220 of file unit.cpp.
References abilities_b_, config::add_child(), attacks_, attacks_b_, cfg_, config::clear_children(), defense_b_, max_experience_, max_experience_b_, max_hit_points_, max_hit_points_b_, max_movement_, max_movement_b_, movement_b_, and resistance_b_.
Referenced by advance_to(), and apply_modifications().
void unit::backup_state | ( | ) |
Definition at line 2235 of file unit.cpp.
References abilities_b_, attacks_, attacks_b_, cfg_, config::child(), lg::config, defense_b_, max_experience_, max_experience_b_, max_hit_points_, max_hit_points_b_, max_movement_, max_movement_b_, movement_b_, and resistance_b_.
Referenced by advance_to().
void unit::apply_modifications | ( | ) |
Definition at line 2721 of file unit.cpp.
References add_modification(), t_string::empty(), unit_race::FEMALE, gender_, gender_string(), config::get_children(), is_fearless_, is_healthy_, log_scope, modification_descriptions_, modifications_, ModificationTypes, name(), NumModificationTypes, reset_modifications(), and traits_description_.
Referenced by add_trait(), advance_to(), new_level(), and unit().
void unit::remove_temporary_modifications | ( | ) |
Definition at line 713 of file unit.cpp.
References config::get_children(), modifications_, ModificationTypes, NumModificationTypes, and config::remove_child().
Referenced by new_level().
void unit::add_trait | ( | std::string | ) |
void unit::generate_traits | ( | bool | musthaveonly = false , |
|
game_state * | state = 0 | |||
) |
Definition at line 381 of file unit.cpp.
References _, config::add_child(), can_recruit(), cfg_, boost::foreach_detail_::end(), lg::engine, lg::err, config::get_children(), get_random(), simple_rng::get_random(), utils::interpolate_variables_into_string(), LOG_STREAM, LOG_UT, modifications_, game_state::rng(), type(), type_id(), and unit_type_data::types().
Referenced by advance_to(), and unit().
void unit::generate_traits_description | ( | ) |
std::string unit::generate_name | ( | simple_rng * | rng = 0 |
) | const [inline] |
Definition at line 291 of file unit.hpp.
References cfg_, unit_race::generate_name(), race_, and string_gender().
bool unit::invisible | ( | const gamemap::location & | loc, | |
const unit_map & | units, | |||
const std::vector< team > & | teams, | |||
bool | see_all = true | |||
) | const |
Definition at line 2772 of file unit.cpp.
References unit_map::begin(), unit_map::end(), get_ability_bool(), get_state(), invisibility_cache_, side_, utils::string_bool(), tiles_adjacent(), and units_with_cache.
Referenced by internal_matches_filter(), unit_display::move_unit(), overlaps(), redraw_unit(), route_turns_to_complete(), and unit_display::unit_visible_on_path().
unit_race::GENDER unit::generate_gender | ( | const unit_type & | type, | |
bool | gen, | |||
game_state * | state = 0 | |||
) |
Definition at line 238 of file unit.cpp.
References cfg_, unit_type::genders(), get_random(), simple_rng::get_random(), unit_race::MALE, and game_state::rng().
Referenced by advance_to(), and read().
std::string unit::image_mods | ( | ) | const |
Definition at line 2935 of file unit.cpp.
References flag_rgb_, team::get_side_colour_index(), image_mods_, and side().
Referenced by overlaps(), redraw_unit(), and still_image().
bool unit::internal_matches_filter | ( | const vconfig & | cfg, | |
const gamemap::location & | loc, | |||
bool | use_flat_tod | |||
) | const [private] |
Definition at line 832 of file unit.cpp.
References ai_special_, variant::as_bool(), attacks(), can_recruit(), vconfig::child(), config::child_range(), defense_modifier(), description, t_string::empty(), unit_map::end(), game_logic::formula::execute(), variable_info::explicit_index, unit_map::find(), gamestatus_, gender(), get_adjacent_tiles(), config::get_children(), vconfig::get_children(), gamemap::get_terrain(), has_ability_by_id(), vconfig::has_attribute(), vconfig::has_child(), unit_race::id(), id_, variable_info::index, invisible(), team::is_enemy(), variable_info::is_valid, variable_info::key, level(), level_, map_, terrain_filter::match(), config::matches(), gamemap::location::matches_range(), movement_cost(), name_, gamemap::on_board(), gamemap::location::parse_directions(), utils::parse_ranges(), race(), race_, role_, side(), utils::split(), utils::string_bool(), string_gender(), teams_, type(), variable_info::TYPE_CONTAINER, type_id(), underlying_id(), units_, gamemap::location::valid(), variable_info::vars, and write().
Referenced by matches_filter().
bool unit::ability_active | ( | const std::string & | ability, | |
const config & | cfg, | |||
const gamemap::location & | loc | |||
) | const [private] |
Definition at line 318 of file unit_abilities.cpp.
References cache_illuminates(), config::child(), unit_map::end(), unit_map::find(), terrain_filter::flatten(), gamestatus_, get_adjacent_tiles(), config::get_children(), map_, terrain_filter::match(), matches_filter(), gamemap::location::NDIRECTIONS, gamemap::location::parse_direction(), utils::split(), and units_.
Referenced by ability_tooltips(), get_abilities(), and get_ability_bool().
bool unit::ability_affects_adjacent | ( | const std::string & | ability, | |
const config & | cfg, | |||
int | dir, | |||
const gamemap::location & | loc | |||
) | const [private] |
Definition at line 372 of file unit_abilities.cpp.
References cache_illuminates(), config::get_children(), matches_filter(), and utils::split().
Referenced by get_abilities(), and get_ability_bool().
bool unit::ability_affects_self | ( | const std::string & | ability, | |
const config & | cfg, | |||
const gamemap::location & | loc | |||
) | const [private] |
Definition at line 398 of file unit_abilities.cpp.
References cache_illuminates(), config::child(), matches_filter(), and utils::string_bool().
Referenced by get_abilities(), and get_ability_bool().
bool unit::resistance_filter_matches | ( | const config & | cfg, | |
bool | attacker, | |||
const std::string & | damage_name | |||
) | const [private] |
Definition at line 2102 of file unit.cpp.
References utils::split().
Referenced by resistance_against(), and resistance_filter_matches().
bool unit::resistance_filter_matches | ( | const config & | cfg, | |
bool | attacker, | |||
const attack_type & | damage_type | |||
) | const [inline, private] |
Definition at line 312 of file unit.hpp.
References resistance_filter_matches(), and attack_type::type().
int unit::movement_cost_internal | ( | t_translation::t_terrain | terrain, | |
int | recurse_count = 0 | |||
) | const [private] |
Definition at line 1957 of file unit.cpp.
References cfg_, config::child(), lg::err, gamemap::get_terrain_info(), LOG_STREAM, map_, t_translation::MINUS, movement_costs_, t_translation::PLUS, gamemap::underlying_mvt_terrain(), and value.
Referenced by movement_cost().
bool unit::has_ability_by_id | ( | const std::string & | ability | ) | const [private] |
Definition at line 762 of file unit.cpp.
References config::all_children(), cfg_, and config::child().
Referenced by add_modification(), and internal_matches_filter().
void unit::remove_ability_by_id | ( | const std::string & | ability | ) | [private] |
Definition at line 777 of file unit.cpp.
References cfg_, config::child(), config::erase(), config::all_children_iterator::get_child(), config::ordered_begin(), and config::ordered_end().
Referenced by add_modification().
void unit::set_underlying_id | ( | ) | [private] |
Definition at line 2818 of file unit.cpp.
References get_random(), unit_type::id(), id(), name_, type(), and underlying_id_.
void unit::clear_visibility_cache | ( | ) | const [inline, private] |
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 417 of file unit.hpp.
References invisibility_cache_.
friend struct unit_movement_resetter [friend] |
void attack_type::set_specials_context | ( | const gamemap::location & | loc, | |
const gamemap::location & | , | |||
const unit & | un, | |||
bool | ||||
) | const [friend] |
config unit::cfg_ [private] |
Definition at line 321 of file unit.hpp.
Referenced by abilities_affects_adjacent(), ability_tooltips(), absolute_image(), add_modification(), advance_to(), backup_state(), can_recruit(), defense_modifier(), generate_gender(), generate_name(), generate_traits(), get_abilities(), get_ability_bool(), get_base_resistances(), get_hit_sound(), has_ability_by_id(), has_ability_type(), image_ellipse(), image_halo(), modification_advancements(), movement_cost_internal(), profile(), read(), remove_ability_by_id(), reset_modifications(), resistance_against(), set_game_context(), unit(), unit_ability_tooltips(), unit_description(), upkeep(), usage(), and write().
config unit::movement_b_ [private] |
Definition at line 322 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
config unit::defense_b_ [private] |
Definition at line 323 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
config unit::resistance_b_ [private] |
Definition at line 324 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
config unit::abilities_b_ [private] |
Definition at line 325 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
std::vector<std::string> unit::advances_to_ [private] |
Definition at line 327 of file unit.hpp.
Referenced by advance_to(), advancement_icons(), advances_to(), can_advance(), get_modification_advances(), read(), and write().
std::string unit::type_ [private] |
Definition at line 328 of file unit.hpp.
Referenced by advance_to(), read(), set_game_context(), and type_id().
const unit_race* unit::race_ [private] |
Definition at line 329 of file unit.hpp.
Referenced by advance_to(), generate_name(), internal_matches_filter(), race(), read(), and write().
std::string unit::id_ [private] |
std::string unit::name_ [private] |
Definition at line 331 of file unit.hpp.
Referenced by internal_matches_filter(), name(), read(), rename(), set_underlying_id(), unit(), and write().
std::string unit::underlying_id_ [private] |
Definition at line 332 of file unit.hpp.
Referenced by read(), set_underlying_id(), underlying_id(), and write().
t_string unit::type_name_ [private] |
Definition at line 333 of file unit.hpp.
Referenced by advance_to(), read(), type_name(), and write().
std::string unit::undead_variation_ [private] |
Definition at line 334 of file unit.hpp.
Referenced by advance_to(), read(), undead_variation(), and write().
std::string unit::variation_ [private] |
Definition at line 335 of file unit.hpp.
Referenced by add_modification(), advance_to(), read(), and write().
int unit::hit_points_ [private] |
Definition at line 337 of file unit.hpp.
Referenced by add_modification(), advance_to(), heal(), heal_all(), hitpoints(), read(), take_hit(), and write().
int unit::max_hit_points_ [private] |
Definition at line 338 of file unit.hpp.
Referenced by add_modification(), advance_to(), backup_state(), max_hitpoints(), read(), and reset_modifications().
int unit::max_hit_points_b_ [private] |
Definition at line 338 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
int unit::experience_ [private] |
Definition at line 339 of file unit.hpp.
Referenced by advances(), experience(), get_experience(), read(), unit(), and write().
int unit::max_experience_ [private] |
Definition at line 340 of file unit.hpp.
Referenced by add_modification(), advance_to(), backup_state(), max_experience(), read(), and reset_modifications().
int unit::max_experience_b_ [private] |
Definition at line 340 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
int unit::level_ [private] |
Definition at line 341 of file unit.hpp.
Referenced by add_modification(), advance_to(), internal_matches_filter(), level(), read(), redraw_unit(), and write().
unit_type::ALIGNMENT unit::alignment_ [private] |
Definition at line 342 of file unit.hpp.
Referenced by advance_to(), alignment(), read(), and write().
std::string unit::flag_rgb_ [private] |
Definition at line 343 of file unit.hpp.
Referenced by advance_to(), image_mods(), read(), team_color(), and write().
std::string unit::image_mods_ [private] |
bool unit::unrenamable_ [private] |
unsigned int unit::side_ [private] |
Definition at line 347 of file unit.hpp.
Referenced by invisible(), read(), redraw_unit(), set_side(), side(), unit(), and write().
unit_race::GENDER unit::gender_ [private] |
Definition at line 348 of file unit.hpp.
Referenced by add_modification(), advance_to(), apply_modifications(), gender(), read(), unit(), and write().
fixed_t unit::alpha_ [private] |
std::string unit::unit_formula_ [private] |
Definition at line 352 of file unit.hpp.
Referenced by get_formula(), has_formula(), read(), and write().
std::vector<std::string> unit::recruits_ [private] |
int unit::movement_ [private] |
Definition at line 357 of file unit.hpp.
Referenced by add_modification(), end_turn(), movement_left(), new_turn(), read(), set_movement(), unit(), unit_movement_resetter::unit_movement_resetter(), write(), and unit_movement_resetter::~unit_movement_resetter().
int unit::max_movement_ [private] |
Definition at line 358 of file unit.hpp.
Referenced by add_modification(), advance_to(), backup_state(), read(), reset_modifications(), set_movement(), and total_movement().
int unit::max_movement_b_ [private] |
Definition at line 358 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
std::map<t_translation::t_terrain, int> unit::movement_costs_ [mutable, private] |
Definition at line 359 of file unit.hpp.
Referenced by add_modification(), advance_to(), and movement_cost_internal().
std::map<t_translation::t_terrain, int> unit::defense_mods_ [mutable, private] |
Definition at line 360 of file unit.hpp.
Referenced by add_modification(), advance_to(), and defense_modifier().
bool unit::hold_position_ [private] |
Definition at line 361 of file unit.hpp.
Referenced by hold_position(), new_turn(), set_hold_position(), set_movement(), unit(), and unit_hold_position().
bool unit::end_turn_ [private] |
Definition at line 362 of file unit.hpp.
Referenced by advance_to(), new_turn(), set_movement(), set_user_end_turn(), unit(), unit_hold_position(), and user_end_turn().
bool unit::resting_ [private] |
Definition at line 363 of file unit.hpp.
Referenced by end_turn(), read(), resting(), set_resting(), and write().
int unit::attacks_left_ [private] |
Definition at line 364 of file unit.hpp.
Referenced by attacks_left(), end_turn(), new_turn(), read(), set_attacks(), unit(), and write().
int unit::max_attacks_ [private] |
Definition at line 365 of file unit.hpp.
Referenced by advance_to(), end_turn(), new_turn(), read(), set_attacks(), and write().
std::map<std::string,std::string> unit::states_ [private] |
Definition at line 367 of file unit.hpp.
Referenced by get_state(), read(), set_state(), and write().
config unit::variables_ [private] |
int unit::emit_zoc_ [private] |
Definition at line 369 of file unit.hpp.
Referenced by add_modification(), advance_to(), emits_zoc(), read(), and write().
STATE unit::state_ [private] |
std::vector<std::string> unit::overlays_ [private] |
Definition at line 372 of file unit.hpp.
Referenced by add_overlay(), overlays(), read(), remove_overlay(), and write().
std::string unit::role_ [private] |
Definition at line 374 of file unit.hpp.
Referenced by assign_role(), internal_matches_filter(), new_level(), read(), and write().
std::string unit::ai_special_ [private] |
Definition at line 375 of file unit.hpp.
Referenced by assign_ai_special(), get_ai_special(), internal_matches_filter(), new_level(), read(), and write().
std::vector<attack_type> unit::attacks_ [private] |
Definition at line 376 of file unit.hpp.
Referenced by add_modification(), advance_to(), attacks(), backup_state(), and reset_modifications().
std::vector<attack_type> unit::attacks_b_ [private] |
Definition at line 376 of file unit.hpp.
Referenced by backup_state(), reset_modifications(), and write().
gamemap::location::DIRECTION unit::facing_ [private] |
Definition at line 377 of file unit.hpp.
Referenced by facing(), overlaps(), read(), redraw_unit(), set_facing(), start_animation(), and write().
t_string unit::traits_description_ [private] |
Definition at line 379 of file unit.hpp.
Referenced by apply_modifications(), and traits_description().
int unit::unit_value_ [private] |
gamemap::location unit::goto_ [private] |
Definition at line 381 of file unit.hpp.
Referenced by get_goto(), new_level(), read(), set_goto(), unit(), and write().
gamemap::location unit::interrupted_move_ [private] |
Definition at line 381 of file unit.hpp.
Referenced by get_interrupted_move(), move_interrupted(), and set_interrupted_move().
bool unit::flying_ [private] |
Definition at line 382 of file unit.hpp.
Referenced by advance_to(), is_flying(), read(), and write().
bool unit::is_fearless_ [private] |
bool unit::is_healthy_ [private] |
Definition at line 382 of file unit.hpp.
Referenced by apply_modifications(), end_turn(), and is_healthy().
string_map unit::modification_descriptions_ [private] |
Definition at line 384 of file unit.hpp.
Referenced by add_modification(), apply_modifications(), and modification_description().
std::vector<unit_animation> unit::animations_ [private] |
Definition at line 386 of file unit.hpp.
Referenced by add_modification(), advance_to(), choose_animation(), and read().
unit_animation* unit::anim_ [private] |
Definition at line 388 of file unit.hpp.
Referenced by get_animation(), overlaps(), redraw_unit(), refresh(), start_animation(), unit(), and ~unit().
int unit::next_idling_ [private] |
int unit::frame_begin_time_ [private] |
Definition at line 390 of file unit.hpp.
Referenced by redraw_unit(), start_animation(), and unit().
int unit::unit_halo_ [private] |
int unit::unit_anim_halo_ [private] |
bool unit::getsHit_ [private] |
bool unit::refreshing_ [private] |
bool unit::hidden_ [private] |
Definition at line 397 of file unit.hpp.
Referenced by advance_to(), get_hidden(), redraw_unit(), set_hidden(), and unit().
bool unit::draw_bars_ [private] |
config unit::modifications_ [private] |
Definition at line 400 of file unit.hpp.
Referenced by add_modification(), apply_modifications(), generate_traits(), modification_count(), read(), remove_temporary_modifications(), and write().
const unit_map* unit::units_ [private] |
Definition at line 403 of file unit.hpp.
Referenced by ability_active(), get_abilities(), get_ability_bool(), internal_matches_filter(), matches_filter(), set_game_context(), and attack_type::set_specials_context().
const gamemap* unit::map_ [private] |
Definition at line 404 of file unit.hpp.
Referenced by ability_active(), defense_modifier(), internal_matches_filter(), movement_cost_internal(), set_game_context(), and attack_type::set_specials_context().
const gamestatus* unit::gamestatus_ [private] |
Definition at line 405 of file unit.hpp.
Referenced by ability_active(), internal_matches_filter(), set_game_context(), and attack_type::set_specials_context().
const std::vector<team>* unit::teams_ [private] |
Definition at line 406 of file unit.hpp.
Referenced by get_abilities(), get_ability_bool(), internal_matches_filter(), set_game_context(), and attack_type::set_specials_context().
std::map<gamemap::location, bool> unit::invisibility_cache_ [mutable, private] |
Hold the visibility status cache for a unit, mutable since it's a cache.
Definition at line 409 of file unit.hpp.
Referenced by clear_visibility_cache(), and invisible().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |