#include <actions.hpp>
Public Types | |
enum | tresult { AI_ACTION_SUCCESS = 0, AI_ACTION_STARTED = 1, AI_ACTION_FAILURE = -1 } |
Public Member Functions | |
virtual | ~action_result () |
void | check_before () |
void | execute () |
bool | is_gamestate_changed () const |
bool | is_ok () |
int | get_status () const |
virtual std::string | do_describe () const =0 |
Protected Member Functions | |
action_result (side_number side) | |
virtual void | do_check_before ()=0 |
virtual void | do_check_after ()=0 |
virtual void | do_execute ()=0 |
virtual void | do_init_for_execution ()=0 |
bool | is_execution () const |
int | get_side () const |
game_info & | get_info () const |
team & | get_my_team () const |
void | set_error (int error_code, bool log_as_error=true) |
bool | is_success () const |
void | set_gamestate_changed () |
Private Member Functions | |
void | check_after () |
void | init_for_execution () |
void | set_ok_checked () |
Private Attributes | |
bool | return_value_checked_ |
int | side_ |
int | status_ |
bool | is_execution_ |
bool | is_gamestate_changed_ |
Friends | |
void | sim_gamestate_changed (action_result *result, bool gamestate_changed) |
Definition at line 40 of file actions.hpp.
Enumerator | |
---|---|
AI_ACTION_SUCCESS | |
AI_ACTION_STARTED | |
AI_ACTION_FAILURE |
Definition at line 45 of file actions.hpp.
|
virtual |
Definition at line 73 of file actions.cpp.
References ERR_AI_ACTIONS, and return_value_checked_.
|
protected |
Definition at line 68 of file actions.cpp.
|
private |
void ai::action_result::check_before | ( | ) |
|
protectedpure virtual |
Implemented in ai::synced_command_result, ai::stopunit_result, ai::recruit_result, ai::recall_result, ai::move_result, and ai::attack_result.
Referenced by check_after().
|
protectedpure virtual |
Implemented in ai::synced_command_result, ai::stopunit_result, ai::recruit_result, ai::recall_result, ai::move_result, and ai::attack_result.
Referenced by check_before().
|
pure virtual |
Implemented in ai::synced_command_result, ai::stopunit_result, ai::recruit_result, ai::recall_result, ai::move_result, and ai::attack_result.
Referenced by set_error().
|
protectedpure virtual |
Implemented in ai::synced_command_result, ai::stopunit_result, ai::recruit_result, ai::recall_result, ai::move_result, and ai::attack_result.
Referenced by execute().
|
protectedpure virtual |
Implemented in ai::synced_command_result, ai::stopunit_result, ai::recruit_result, ai::recall_result, ai::move_result, and ai::attack_result.
Referenced by init_for_execution().
void ai::action_result::execute | ( | ) |
Definition at line 90 of file actions.cpp.
References check_after(), check_before(), DBG_AI_ACTIONS, do_execute(), init_for_execution(), is_execution_, is_ok(), and is_success().
|
protected |
Definition at line 161 of file actions.cpp.
References ai::manager::get_active_ai_info_for_side(), and get_side().
Referenced by ai::attack_result::do_execute().
|
protected |
Definition at line 166 of file actions.cpp.
References side_, and resources::teams.
Referenced by ai::attack_result::do_check_before(), ai::recall_result::do_check_before(), ai::recruit_result::do_check_before(), and ai::move_result::test_route().
|
inlineprotected |
Definition at line 89 of file actions.hpp.
References side_.
Referenced by ai::recall_result::do_check_after(), ai::recruit_result::do_check_after(), ai::attack_result::do_check_before(), ai::recall_result::do_check_before(), ai::recruit_result::do_check_before(), ai::attack_result::do_describe(), ai::move_result::do_describe(), ai::recall_result::do_describe(), ai::recruit_result::do_describe(), ai::stopunit_result::do_describe(), ai::synced_command_result::do_describe(), ai::move_result::do_execute(), ai::recall_result::do_execute(), ai::recruit_result::do_execute(), get_info(), ai::move_result::get_unit(), and ai::stopunit_result::get_unit().
int ai::action_result::get_status | ( | ) | const |
Definition at line 146 of file actions.cpp.
References status_.
|
private |
Definition at line 109 of file actions.cpp.
References AI_ACTION_SUCCESS, do_init_for_execution(), is_gamestate_changed_, return_value_checked_, and status_.
Referenced by execute().
|
protected |
bool ai::action_result::is_gamestate_changed | ( | ) | const |
Definition at line 117 of file actions.cpp.
References is_gamestate_changed_.
Referenced by ai::move_result::do_execute().
bool ai::action_result::is_ok | ( | ) |
Definition at line 122 of file actions.cpp.
References is_success(), and return_value_checked_.
Referenced by ai::attack_result::do_execute(), ai::move_result::do_execute(), ai::recall_result::do_execute(), ai::recruit_result::do_execute(), ai::stopunit_result::do_execute(), ai::synced_command_result::do_execute(), and execute().
|
protected |
Definition at line 151 of file actions.cpp.
References AI_ACTION_SUCCESS, and status_.
Referenced by ai::move_result::do_execute(), ai::recall_result::do_execute(), ai::recruit_result::do_execute(), ai::stopunit_result::do_execute(), ai::synced_command_result::do_execute(), execute(), and is_ok().
Definition at line 128 of file actions.cpp.
References do_describe(), ERR_AI_ACTIONS, ai::actions::get_error_name(), is_execution(), LOG_AI_ACTIONS, and status_.
Referenced by ai::move_result::do_check_after(), ai::recall_result::do_check_after(), ai::recruit_result::do_check_after(), ai::stopunit_result::do_check_after(), ai::attack_result::do_check_before(), ai::recall_result::do_check_before(), ai::recruit_result::do_check_before(), ai::attack_result::do_execute(), ai::move_result::do_execute(), ai::recall_result::get_recall_unit(), ai::move_result::get_unit(), ai::stopunit_result::get_unit(), ai::recruit_result::get_unit_type_known(), ai::recall_result::test_enough_gold(), ai::recruit_result::test_enough_gold(), and ai::move_result::test_route().
|
protected |
Definition at line 141 of file actions.cpp.
References is_gamestate_changed_.
Referenced by ai::attack_result::do_execute(), ai::move_result::do_execute(), ai::recall_result::do_execute(), ai::recruit_result::do_execute(), ai::stopunit_result::do_execute(), ai::synced_command_result::do_execute(), and ai::sim_gamestate_changed().
|
private |
|
friend |
Definition at line 1117 of file actions.cpp.
Referenced by ai::attack_result::do_execute(), ai::move_result::do_execute(), ai::recall_result::do_execute(), ai::recruit_result::do_execute(), ai::stopunit_result::do_execute(), and ai::synced_command_result::do_execute().
|
private |
Definition at line 125 of file actions.hpp.
Referenced by execute(), and is_execution().
|
private |
Definition at line 127 of file actions.hpp.
Referenced by init_for_execution(), is_gamestate_changed(), and set_gamestate_changed().
|
private |
Definition at line 116 of file actions.hpp.
Referenced by init_for_execution(), is_ok(), and ~action_result().
|
private |
Definition at line 119 of file actions.hpp.
Referenced by get_my_team(), and get_side().
|
private |
Definition at line 122 of file actions.hpp.
Referenced by get_status(), init_for_execution(), is_success(), and set_error().