Various functions that implement advancements of units. More...
#include "map/location.hpp"
#include "units/attack_type.hpp"
#include "units/ptr.hpp"
#include "units/race.hpp"
#include "utils/variant.hpp"
#include <string>
#include <vector>
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 ¶ms) |
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... | |
Various functions that implement advancements of units.
Definition in file advancement.hpp.
using advancement_option = utils::variant<std::string , const config* > |
Definition at line 67 of file advancement.hpp.
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 345 of file advancement.cpp.
References actions::actor_sighted(), statistics::advance_unit(), actions::shroud_clearer::clear_unit(), utils::decayed_is_same, 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 | ) |
Definition at line 271 of file advancement.cpp.
References advance_unit_params::animate_, DBG_NG, ERR_NG, unit_map::find(), game_events::wml_event_pump::fire(), advance_unit_params::fire_events_, advance_unit_params::force_dialog_, resources::game_events, resources::gameboard, resources::gamedata, mp_sync::get_user_choice(), advance_unit_params::loc_, LOG_NG, unit_helper::number_of_possible_advances(), game_data::phase(), game_data::PLAY, game_events::manager::pump(), game_config::images::selected, game_board::units(), unit_map::iterator_base< iter_types >::valid(), unit_helper::will_certainly_advance(), and WRN_NG.
Referenced by attack_unit_and_advance(), intf_advance_unit(), and SYNCED_COMMAND_HANDLER_FUNCTION().
Returns the advanced version of a unit (with traits and items retained).
Definition at line 313 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().
Returns the AMLA-advanced version of a unit (with traits and items retained).
Definition at line 336 of file advancement.cpp.
References unit::clone().
Referenced by advance_unit().