95 void set_error(
int error_code,
bool log_as_error =
true);
168 bool remove_movement,
195 std::shared_ptr<pathfind::plain_route>
route_;
223 const team& my_team);
225 const team& my_team);
255 const std::string &recruit);
271 bool remove_movement,
272 bool remove_attacks );
296 const std::string& lua_code,
351 bool remove_movement,
352 bool unreach_is_ok =
false);
367 const std::string& unit_id,
401 bool remove_movement,
402 bool remove_attacks );
415 const std::string& lua_code,
Various functions related to moving units.
std::ostream & operator<<(std::ostream &s, const ai::attack_result &r)
virtual void do_check_before()=0
void init_for_execution()
virtual void do_execute()=0
bool return_value_checked_
void set_gamestate_changed()
game_info & get_info() const
virtual void do_init_for_execution()=0
action_result(side_number side)
bool is_gamestate_changed() const
friend void sim_gamestate_changed(action_result *result, bool gamestate_changed)
virtual void do_check_after()=0
bool is_gamestate_changed_
team & get_my_team() const
virtual std::string do_describe() const =0
bool is_execution() const
void set_error(int error_code, bool log_as_error=true)
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.
static const std::map< int, std::string > error_names_
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.
static const std::string & get_error_name(int error_code)
get human-readable name of the error by code.
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,...
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 mov...
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.
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.
virtual void do_execute()
attack_result(side_number side, const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon, double aggression)
virtual std::string do_describe() const
virtual void do_check_before()
const map_location & attacker_loc_
const map_location & defender_loc_
virtual void do_init_for_execution()
@ E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON
@ E_ATTACKER_AND_DEFENDER_NOT_ADJACENT
@ E_INCAPACITATED_ATTACKER
@ E_WRONG_ATTACKER_WEAPON
@ E_INCAPACITATED_DEFENDER
virtual void do_check_after()
virtual const map_location & get_unit_location() const
bool has_interrupted_teleport_
bool test_route(const unit &un)
virtual void do_check_after()
virtual void do_execute()
virtual void do_check_before()
std::shared_ptr< pathfind::plain_route > route_
move_result(side_number side, const map_location &from, const map_location &to, bool remove_movement, bool unreach_is_ok)
virtual void do_init_for_execution()
map_location unit_location_
virtual std::string do_describe() const
recall_result(side_number side, const std::string &unit_id, const map_location &where, const map_location &from)
virtual std::string do_describe() const
virtual void do_init_for_execution()
map_location recall_location_
const std::string & unit_id_
virtual void do_check_after()
bool test_enough_gold(const team &my_team)
@ E_NOT_AVAILABLE_FOR_RECALLING
unit_const_ptr get_recall_unit(const team &my_team)
virtual void do_check_before()
map_location recall_from_
virtual void do_execute()
const map_location where_
virtual void do_check_before()
virtual void do_execute()
map_location recruit_from_
const unit_type * get_unit_type_known(const std::string &recruit)
map_location recruit_location_
virtual std::string do_describe() const
bool test_enough_gold(const team &my_team, const unit_type &type)
const map_location & where_
virtual void do_check_after()
@ E_NOT_AVAILABLE_FOR_RECRUITING
@ E_UNKNOWN_OR_DUMMY_UNIT_TYPE
recruit_result(side_number side, const std::string &unit_name, const map_location &where, const map_location &from)
virtual void do_init_for_execution()
const std::string & unit_name_
virtual void do_init_for_execution()
virtual void do_execute()
virtual void do_check_before()
virtual std::string do_describe() const
const bool remove_movement_
const bool remove_attacks_
stopunit_result(side_number side, const map_location &unit_location, bool remove_movement, bool remove_attacks)
const map_location & unit_location_
virtual void do_check_after()
virtual std::string do_describe() const
virtual void do_check_after()
const map_location & location_
virtual void do_init_for_execution()
synced_command_result(side_number side, const std::string &lua_code, const map_location &location)
virtual void do_check_before()
const std::string & lua_code_
virtual void do_execute()
This class stores all the data for a single 'side' (in game nomenclature).
A single unit type that the player may recruit.
This class represents a single unit of a specific type.
Game information for the AI.
A small explanation about what's going on here: Each action has access to two game_info objects First...
std::shared_ptr< recruit_result > recruit_result_ptr
std::shared_ptr< attack_result > attack_result_ptr
std::shared_ptr< stopunit_result > stopunit_result_ptr
std::shared_ptr< synced_command_result > synced_command_result_ptr
std::shared_ptr< move_result > move_result_ptr
std::shared_ptr< recall_result > recall_result_ptr
std::shared_ptr< const unit > unit_const_ptr
static config unit_name(const unit *u)
Encapsulates the map of the game.
Structure which holds a single route between one location and another.
static map_location::direction s