The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions
unit_display Namespace Reference

Contains a number of free functions which display units. More...

Classes

class  unit_mover
 A class to encapsulate the steps of drawing a unit's move. More...
 

Functions

void move_unit (const std::vector< map_location > &path, unit_ptr u, bool animate, map_location::DIRECTION dir, bool force_scroll)
 Display a unit moving along a given path. More...
 
void reset_helpers (const unit *attacker, const unit *defender)
 
void unit_draw_weapon (const map_location &loc, unit &u, const_attack_ptr attack=nullptr, const_attack_ptr secondary_attack=nullptr, const map_location &defender_loc=map_location::null_location(), unit *defender=nullptr)
 Play a pre-fight animation First unit is the attacker, second unit the defender. More...
 
void unit_sheath_weapon (const map_location &loc, unit *u=nullptr, const_attack_ptr attack=nullptr, const_attack_ptr secondary_attack=nullptr, const map_location &defender_loc=map_location::null_location(), unit *defender=nullptr)
 Play a post-fight animation Both unit can be set to null, only valid units will play their animation. More...
 
void unit_die (const map_location &loc, unit &u, const_attack_ptr attack=nullptr, const_attack_ptr secondary_attack=nullptr, const map_location &winner_loc=map_location::null_location(), unit *winner=nullptr)
 Show a unit fading out. More...
 
void unit_attack (display *disp, game_board &board,const map_location &a, const map_location &b, int damage, const attack_type &attack, const_attack_ptr secondary_attack, int swing, const std::string &hit_text, int drain_amount, const std::string &att_text, const std::vector< std::string > *extra_hit_sounds=nullptr)
 Make the unit on tile 'a' attack the unit on tile 'b'. More...
 
void unit_recruited (const map_location &loc, const map_location &leader_loc)
 
void unit_healing (unit &healed, const std::vector< unit * > &healers, int healing, const std::string &extra_text="")
 This will use a poisoning anim if healing<0. More...
 

Detailed Description

Contains a number of free functions which display units.

performing various on-screen actions - moving, attacking, and dying.

Function Documentation

void unit_display::move_unit ( const std::vector< map_location > &  path,
unit_ptr  u,
bool  animate,
map_location::DIRECTION  dir,
bool  force_scroll 
)

Display a unit moving along a given path.

Parameters
pathThe path to traverse.
uThe unit to show being moved. Its facing will be updated, but not its position.
animateIf set to false, only side-effects of move are applied (correct unit facing, path hexes redrawing).
dirUnit will be set facing this direction after move. If nothing passed, direction will be set based on path.

Definition at line 481 of file udisplay.cpp.

References unit_display::unit_mover::finish(), unit_display::unit_mover::proceed_to(), and unit_display::unit_mover::start().

Referenced by wb::manager::create_temp_move(), game_lua_kernel::intf_teleport(), wb::move::move(), ai::simulated_move(), actions::undo::move_action::undo(), and game_events::WML_HANDLER_FUNCTION().

void unit_display::reset_helpers ( const unit attacker,
const unit defender 
)
void unit_display::unit_attack ( display disp,
game_board board,
const map_location a,
const map_location b,
int  damage,
const attack_type attack,
const_attack_ptr  secondary_attack,
int  swing,
const std::string &  hit_text,
int  drain_amount,
const std::string &  att_text,
const std::vector< std::string > *  extra_hit_sounds = nullptr 
)
void unit_display::unit_die ( const map_location loc,
unit u,
const_attack_ptr  attack = nullptr,
const_attack_ptr  secondary_attack = nullptr,
const map_location winner_loc = map_location::null_location(),
unit winner = nullptr 
)
void unit_display::unit_draw_weapon ( const map_location loc,
unit attacker,
const_attack_ptr  attack,
const_attack_ptr  secondary_attack,
const map_location defender_loc,
unit defender 
)
void unit_display::unit_healing ( unit healed,
const std::vector< unit * > &  healers,
int  healing,
const std::string &  extra_text 
)
void unit_display::unit_recruited ( const map_location loc,
const map_location leader_loc 
)
void unit_display::unit_sheath_weapon ( const map_location primary_loc,
unit primary_unit,
const_attack_ptr  primary_attack,
const_attack_ptr  secondary_attack,
const map_location secondary_loc,
unit secondary_unit 
)