The Battle for Wesnoth  1.19.5+dev
Classes | Typedefs | Functions
advancement.hpp File Reference

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

#include "map/location.hpp"
#include "units/ptr.hpp"
#include "utils/variant.hpp"
#include <string>
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 = utils::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

◆ advancement_option

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

Definition at line 62 of file advancement.hpp.

Function Documentation

◆ advance_unit()

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 344 of file advancement.cpp.

References actions::actor_sighted(), statistics_t::advance_unit(), actions::shroud_clearer::clear_unit(), resources::controller, utils::decayed_is_same, prefs::encountered_units(), unit_map::erase(), unit_map::find(), game_events::wml_event_pump::fire(), gui2::event::implementation::fire_event(), actions::shroud_clearer::fire_events(), resources::game_events, resources::gameboard, prefs::get(), get_advanced_unit(), get_amla_unit(), actions::get_sides_not_seeing(), unit_map::insert(), LOG_CF, LOG_NG, game_events::manager::pump(), play_controller::statistics(), game_board::units(), unit_map::iterator_base< iter_types >::valid(), and resources::whiteboard.

Referenced by ai::helper_advance_unit().

◆ advance_unit_at()

void advance_unit_at ( const advance_unit_params params)

◆ get_advanced_unit()

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 312 of file advancement.cpp.

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

Referenced by advance_unit().

◆ get_amla_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 335 of file advancement.cpp.

References unit::clone().

Referenced by advance_unit().