#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, const unit_advancements_aspect &advancements=unit_advancements_aspect()) |
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 std::map< int, std::string > | error_names_ |
Definition at line 315 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 | result: ok |
possible | result: something wrong |
possible | result: attacker and/or defender are invalid |
possible | result: attacker doesn't have the specified weapon |
Definition at line 994 of file actions.cpp.
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 |
possible | result: ok |
possible | result: something wrong |
possible | result: move is interrupted |
possible | result: move is impossible |
Definition at line 1007 of file actions.cpp.
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. |
possible | result: ok |
possible_result | something wrong |
possible_result | leader not on keep |
possible_result | no free space on keep |
possible_result | not enough gold |
Definition at line 1019 of file actions.cpp.
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. |
possible | result: ok |
possible_result | something wrong |
possible_result | leader not on keep |
possible_result | no free space on keep |
possible_result | not enough gold |
Definition at line 1030 of file actions.cpp.
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 | result: ok |
possible_result | something wrong |
possible_result | nothing to do |
Definition at line 1041 of file actions.cpp.
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 | result: ok |
possible_result | something wrong |
possible_result | nothing to do |
Definition at line 1052 of file actions.cpp.
Referenced by ai::ai_synced_command(), 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 1062 of file actions.cpp.
References ai::action_result::AI_ACTION_FAILURE, ai::action_result::AI_ACTION_STARTED, ai::action_result::AI_ACTION_SUCCESS, ai::move_result::E_AMBUSHED, ai::attack_result::E_ATTACKER_AND_DEFENDER_NOT_ADJACENT, ai::recall_result::E_BAD_RECALL_LOCATION, ai::recruit_result::E_BAD_RECRUIT_LOCATION, ai::attack_result::E_EMPTY_ATTACKER, ai::attack_result::E_EMPTY_DEFENDER, ai::move_result::E_EMPTY_MOVE, ai::move_result::E_FAILED_TELEPORT, ai::attack_result::E_INCAPACITATED_ATTACKER, ai::attack_result::E_INCAPACITATED_DEFENDER, ai::move_result::E_INCAPACITATED_UNIT, ai::stopunit_result::E_INCAPACITATED_UNIT, ai::recall_result::E_LEADER_NOT_ON_KEEP, ai::recruit_result::E_LEADER_NOT_ON_KEEP, ai::attack_result::E_NO_ATTACKS_LEFT, ai::recall_result::E_NO_GOLD, ai::recruit_result::E_NO_GOLD, ai::recall_result::E_NO_LEADER, ai::recruit_result::E_NO_LEADER, ai::move_result::E_NO_ROUTE, ai::move_result::E_NO_UNIT, ai::stopunit_result::E_NO_UNIT, ai::recall_result::E_NOT_AVAILABLE_FOR_RECALLING, ai::recruit_result::E_NOT_AVAILABLE_FOR_RECRUITING, ai::attack_result::E_NOT_ENEMY_DEFENDER, ai::attack_result::E_NOT_OWN_ATTACKER, ai::move_result::E_NOT_OWN_UNIT, ai::stopunit_result::E_NOT_OWN_UNIT, ai::move_result::E_NOT_REACHED_DESTINATION, ai::attack_result::E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON, ai::recruit_result::E_UNKNOWN_OR_DUMMY_UNIT_TYPE, ai::attack_result::E_WRONG_ATTACKER_WEAPON, ERR_AI_ACTIONS, error_names_, and i.
Referenced by ai::action_result::set_error(), and ai::transform_ai_action().
|
staticprivate |
Definition at line 448 of file actions.hpp.
Referenced by get_error_name().