#include <actions.hpp>
Static Public Member Functions | |
static attack_result_ptr | execute_attack_action (side_number side, bool execute, const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon, double aggression) |
Ask the game to attack an enemy defender using our unit attacker from attackers current location,. More... | |
static move_result_ptr | execute_move_action (side_number side, bool execute, const map_location &from, const map_location &to, bool remove_movement, bool unreach_is_ok=false) |
Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move. More... | |
static recall_result_ptr | execute_recall_action (side_number side, bool execute, const std::string &unit_id, const map_location &where, const map_location &from) |
Ask the game to recall a unit for us on specified location. More... | |
static recruit_result_ptr | execute_recruit_action (side_number side, bool execute, const std::string &unit_name, const map_location &where, const map_location &from) |
Ask the game to recruit a unit for us on specified location. More... | |
static stopunit_result_ptr | execute_stopunit_action (side_number side, bool execute, const map_location &unit_location, bool remove_movement, bool remove_attacks) |
Ask the game to remove unit movements and/or attack. More... | |
static synced_command_result_ptr | execute_synced_command_action (side_number side, bool execute, const std::string &lua_code, const map_location &location) |
Ask the game to run Lua code. More... | |
static const std::string & | get_error_name (int error_code) |
get human-readable name of the error by code. More... | |
Static Private Attributes | |
static const std::map< int, std::string > | error_names_ |
Definition at line 311 of file actions.hpp.
|
static |
Ask the game to attack an enemy defender using our unit attacker from attackers current location,.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
attacker_loc | location of attacker |
defender_loc | location of defender |
attacker_weapon | weapon of attacker |
aggression | aggression of attacker, is used to determine attacker's weapon if it is not specified |
possible | results: ok, something wrong, attacker and/or defender are invalid, or attacker doesn't have the specified weapon |
Definition at line 1030 of file actions.cpp.
References ai::execute_or_check().
Referenced by ai::ai_attack(), ai::readonly_context_impl::check_attack_action(), and ai::readwrite_context_impl::execute_attack_action().
|
static |
Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
from | location of our unit |
to | where to move |
remove_movement | set unit movement to 0 in case of successful move |
unreach_is_ok | whether it's okay for a destination to be unreachable |
possible | results: ok, something wrong, move is interrupted, or move is impossible |
Definition at line 1042 of file actions.cpp.
References ai::execute_or_check().
Referenced by ai::ai_move(), ai::readonly_context_impl::check_move_action(), and ai::readwrite_context_impl::execute_move_action().
|
static |
Ask the game to recall a unit for us on specified location.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
unit_id | the id of the unit to be recalled. |
where | location where the unit is to be recalled. |
from | the location where the unit was recruited from. |
possible | results: ok, something wrong, leader not on keep, no free space on keep, or not enough gold |
Definition at line 1054 of file actions.cpp.
References ai::execute_or_check().
Referenced by ai::ai_recall(), ai::readonly_context_impl::check_recall_action(), and ai::readwrite_context_impl::execute_recall_action().
|
static |
Ask the game to recruit a unit for us on specified location.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
unit_name | the name of the unit to be recruited. |
where | location where the unit is to be recruited. |
from | the location where the unit was recruited from. |
possible | results: ok, something wrong, leader not on keep, no free space on keep, or not enough gold |
Definition at line 1065 of file actions.cpp.
References ai::execute_or_check(), and unit_name().
Referenced by ai::ai_recruit(), ai::readonly_context_impl::check_recruit_action(), and ai::readwrite_context_impl::execute_recruit_action().
|
static |
Ask the game to remove unit movements and/or attack.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
unit_location | the location of our unit |
remove_movement | set remaining movements to 0 |
remove_attacks | set remaining attacks to 0 |
possible | results: ok, something wrong, or nothing to do |
Definition at line 1076 of file actions.cpp.
References ai::execute_or_check().
Referenced by ai::ai_stopunit_select(), ai::readonly_context_impl::check_stopunit_action(), ai::move_result::do_execute(), and ai::readwrite_context_impl::execute_stopunit_action().
|
static |
Ask the game to run Lua code.
side | the side which tries to execute the move |
execute | should move be actually executed or not |
lua_code | the code to be run |
location | location to be passed to the code as x1/y1 |
possible | results: ok, something wrong, or nothing to do |
Definition at line 1087 of file actions.cpp.
References ai::execute_or_check().
Referenced by ai::readonly_context_impl::check_synced_command_action(), and ai::readwrite_context_impl::execute_synced_command_action().
|
static |
get human-readable name of the error by code.
error_code | error code. |
result | the name of the error. |
Definition at line 1097 of file actions.cpp.
References ERR_AI_ACTIONS, error_names_, and i.
Referenced by ai::action_result::set_error(), and ai::transform_ai_action().
|
staticprivate |
Definition at line 428 of file actions.hpp.
Referenced by get_error_name().