The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Functions
advancement.hpp File Reference

Various functions that implement advancements of units. More...

#include "units/types.hpp"
#include "ai/lua/aspect_advancements.hpp"
#include <string>
#include <vector>
Include dependency graph for advancement.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  advance_unit_params
 advances the unit at loc if it has enough experience, maximum 20 times. More...
 

Typedefs

using advancement_option = boost::variant< std::string, const config * >
 

Functions

void advance_unit_at (const advance_unit_params &params)
 
unit_ptr get_advanced_unit (const unit &u, const std::string &advance_to)
 Returns the advanced version of a unit (with traits and items retained). More...
 
unit_ptr get_amla_unit (const unit &u, const config &mod_option)
 Returns the AMLA-advanced version of a unit (with traits and items retained). More...
 
void advance_unit (map_location loc, const advancement_option &advance_to, bool fire_event=true)
 Function which will advance the unit at loc to 'advance_to'. More...
 

Detailed Description

Various functions that implement advancements of units.

Definition in file advancement.hpp.

Typedef Documentation

using advancement_option = boost::variant<std::string , const config* >

Definition at line 66 of file advancement.hpp.

Function Documentation

void advance_unit ( map_location  loc,
const advancement_option advance_to,
bool  fire_event = true 
)

Function which will advance the unit at loc to 'advance_to'.

which is eigher a type to advance to or a config containing the [advancement] to perform an amla. Note that 'loc' is not a reference, because if it were a reference, we couldn't safely pass in a reference to the item in the map that we're going to delete, since deletion would invalidate the reference.

Definition at line 314 of file advancement.cpp.

References actions::actor_sighted(), statistics::advance_unit(), actions::shroud_clearer::clear_unit(), preferences::encountered_units(), unit_map::erase(), unit_map::find(), game_events::wml_event_pump::fire(), actions::shroud_clearer::fire_events(), resources::game_events, resources::gameboard, get_advanced_unit(), get_amla_unit(), actions::get_sides_not_seeing(), unit_map::insert(), LOG_CF, LOG_NG, game_events::manager::pump(), game_board::units(), unit_map::iterator_base< iter_types >::valid(), and resources::whiteboard.

Referenced by ai::helper_advance_unit().

void advance_unit_at ( const advance_unit_params params)
unit_ptr get_advanced_unit ( const unit u,
const std::string &  advance_to 
)

Returns the advanced version of a unit (with traits and items retained).

Definition at line 282 of file advancement.cpp.

References unit_type_data::find(), unit::STATE_PETRIFIED, unit::STATE_POISONED, unit::STATE_SLOWED, and unit_types.

Referenced by advance_unit().

unit_ptr get_amla_unit ( const unit u,
const config mod_option 
)

Returns the AMLA-advanced version of a unit (with traits and items retained).

Definition at line 305 of file advancement.cpp.

Referenced by advance_unit().