The Battle for Wesnoth  1.19.7+dev
Functions
Image and animations functions

Functions

unit_animation_componentunit::anim_comp () const
 
std::string unit::absolute_image () const
 The name of the file to game_display (used in menus). More...
 
std::string unit::default_anim_image () const
 The default image to use for animation frames with no defined image. More...
 
std::string unit::image_halo () const
 Get the unit's halo image. More...
 
std::vector< std::string > unit::halo_or_icon_abilities (const std::string &image_type) const
 
std::vector< std::string > unit::halo_abilities () const
 Get the [halo] abilities halo image(s). More...
 
void unit::set_image_halo (const std::string &halo)
 Set the unit's halo image. More...
 
std::string unit::image_ellipse () const
 Get the unit's ellipse image. More...
 
void unit::set_image_ellipse (const std::string &ellipse)
 Set the unit's ellipse image. More...
 
const std::string & unit::flag_rgb () const
 Get the source color palette to use when recoloring the unit's image. More...
 
std::string unit::TC_image_mods () const
 Constructs a recolor (RC) IPF string for this unit's team color. More...
 
const std::string & unit::effect_image_mods () const
 Gets any IPF image mods applied by effects. More...
 
std::string unit::image_mods () const
 Gets an IPF string containing all IPF image mods. More...
 
const std::vector< std::string > & unit::overlays () const
 Get the unit's overlay images. More...
 
std::vector< std::string > unit::overlays_abilities () const
 Get the [overlay] ability overlay images. More...
 
color_t unit::hp_color () const
 Color for this unit's current hitpoints. More...
 
static color_t unit::hp_color_max ()
 
color_t unit::hp_color (int hitpoints) const
 Color for this unit's hitpoints. More...
 
color_t unit::xp_color () const
 Color for this unit's XP. More...
 
static color_t unit::xp_color (int xp_to_advance, bool can_advance, bool has_amla)
 

Detailed Description

Function Documentation

◆ absolute_image()

std::string unit::absolute_image ( ) const

◆ anim_comp()

unit_animation_component& unit::anim_comp ( ) const
inline

◆ default_anim_image()

std::string unit::default_anim_image ( ) const

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

Definition at line 2562 of file unit.cpp.

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

Referenced by unit_drawer::redraw_unit().

◆ effect_image_mods()

const std::string& unit::effect_image_mods ( ) const
inline

Gets any IPF image mods applied by effects.

Definition at line 1664 of file unit.hpp.

References unit::image_mods_.

Referenced by UNIT_GETTER().

◆ flag_rgb()

const std::string & unit::flag_rgb ( ) const

Get the source color palette to use when recoloring the unit's image.

Definition at line 1146 of file unit.cpp.

References unit::flag_rgb_, and game_config::unit_rgb.

Referenced by gui2::dialogs::faction_select::on_faction_select(), and unit::TC_image_mods().

◆ halo_abilities()

std::vector<std::string> unit::halo_abilities ( ) const
inline

Get the [halo] abilities halo image(s).

Definition at line 1634 of file unit.hpp.

References unit::halo_or_icon_abilities().

◆ halo_or_icon_abilities()

std::vector< std::string > unit::halo_or_icon_abilities ( const std::string &  image_type) const

◆ hp_color() [1/2]

color_t unit::hp_color ( ) const

Color for this unit's current hitpoints.

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

Definition at line 1172 of file unit.cpp.

References unit::hitpoints(), hp_color_impl(), and unit::max_hitpoints().

Referenced by gui2::dialogs::unit_list::pre_show(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_display_data(), unit_hp(), and unit_weapons().

◆ hp_color() [2/2]

color_t unit::hp_color ( int  hitpoints) const

Color for this unit's hitpoints.

Parameters
hitpointsThe number of hitpoints the color represents.
Returns
The color considering the current hitpoints as base.

Definition at line 1177 of file unit.cpp.

References unit::hitpoints(), and hp_color_impl().

◆ hp_color_max()

color_t unit::hp_color_max ( )
static

Definition at line 1182 of file unit.cpp.

References hp_color_impl().

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

◆ image_ellipse()

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

Get the unit's ellipse image.

Definition at line 1643 of file unit.hpp.

References unit::ellipse_.

Referenced by unit_drawer::draw_ellipses(), and UNIT_GETTER().

◆ image_halo()

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

Get the unit's halo image.

Definition at line 1626 of file unit.hpp.

References unit::halo_.

Referenced by UNIT_GETTER().

◆ image_mods()

std::string unit::image_mods ( ) const

◆ overlays()

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

◆ overlays_abilities()

std::vector<std::string> unit::overlays_abilities ( ) const
inline

Get the [overlay] ability overlay images.

Definition at line 1683 of file unit.hpp.

References unit::halo_or_icon_abilities().

Referenced by unit_drawer::redraw_unit().

◆ set_image_ellipse()

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

Set the unit's ellipse image.

Definition at line 1649 of file unit.hpp.

References unit::appearance_changed_, and unit::ellipse_.

Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), and UNIT_SETTER().

◆ set_image_halo()

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

Set the unit's halo image.

Definition at line 2790 of file unit.cpp.

References unit::anim_comp_, unit::appearance_changed_, and unit::halo_.

Referenced by unit::advance_to(), unit::apply_builtin_effect(), unit::init(), and UNIT_SETTER().

◆ TC_image_mods()

std::string unit::TC_image_mods ( ) const

Constructs a recolor (RC) IPF string for this unit's team color.

Definition at line 2733 of file unit.cpp.

References unit::flag_rgb(), team::get_side_color_id(), and unit::side().

Referenced by unit::image_mods(), and unit_drawer::redraw_unit().

◆ xp_color() [1/2]

color_t unit::xp_color ( ) const

◆ xp_color() [2/2]

color_t unit::xp_color ( int  xp_to_advance,
bool  can_advance,
bool  has_amla 
)
static

Definition at line 1187 of file unit.cpp.

References unit::can_advance(), and game_config::kill_experience.