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

Functions

int number_of_possible_advances (const unit &unit)
 Determines the total number of available advancements (of any kind) for a given unit. More...
 
bool will_certainly_advance (const unit_map::iterator &u)
 Encapsulates the logic for deciding whether an iterator u points to a unit that can advance. More...
 
std::string resistance_color (const int resistance)
 

Function Documentation

int unit_helper::number_of_possible_advances ( const unit unit)

Determines the total number of available advancements (of any kind) for a given unit.

This includes normal advances and modifiers.

Returns
the total number of possible advancements.

Definition at line 26 of file helper.cpp.

References unit::advances_to(), and unit::get_modification_advances().

Referenced by advance_unit_at(), ai::helper_advance_unit(), and will_certainly_advance().

std::string unit_helper::resistance_color ( const int  resistance)
Returns
the name of the color encoding the weight of the unit's resistance value for presenting it to the player.

Definition at line 36 of file helper.cpp.

Referenced by help::unit_topic_generator::operator()(), and unit_hp().

bool unit_helper::will_certainly_advance ( const unit_map::iterator u)

Encapsulates the logic for deciding whether an iterator u points to a unit that can advance.

Returns
true if the unit exists, has available advances, and can_advance().

Definition at line 31 of file helper.cpp.

References number_of_possible_advances(), and unit_map::iterator_base< iter_types >::valid().

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