#include <actions.hpp>
Public Types | |
enum | result { 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 38 of file actions.hpp.
Enumerator | |
---|---|
AI_ACTION_SUCCESS | |
AI_ACTION_STARTED | |
AI_ACTION_FAILURE |
Definition at line 43 of file actions.hpp.
|
virtual |
Definition at line 75 of file actions.cpp.
References DBG_AI_ACTIONS, and return_value_checked_.
|
protected |
Definition at line 70 of file actions.cpp.
|
private |
void ai::action_result::check_before | ( | ) |
Definition at line 87 of file actions.cpp.
References do_check_before().
Referenced by execute(), and ai::execute_or_check().
|
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 92 of file actions.cpp.
References check_after(), check_before(), DBG_AI_ACTIONS, do_execute(), init_for_execution(), is_execution_, is_ok(), and is_success().
Referenced by ai::execute_or_check(), ai::default_recruitment::recruitment::execute_recall(), ai::default_recruitment::recruitment::execute_recruit(), wfl::recall_callable::execute_self(), and wfl::recruit_callable::execute_self().
|
protected |
Definition at line 163 of file actions.cpp.
References ai::manager::get_active_ai_info_for_side(), get_side(), and ai::manager::get_singleton().
Referenced by ai::attack_result::do_execute().
|
protected |
Definition at line 168 of file actions.cpp.
References resources::gameboard, game_board::get_team(), and side_.
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 87 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 148 of file actions.cpp.
References status_.
Referenced by ai::default_recruitment::recruitment::execute(), wfl::attack_callable::execute_self(), wfl::move_callable::execute_self(), wfl::move_partial_callable::execute_self(), wfl::recall_callable::execute_self(), wfl::recruit_callable::execute_self(), and ai::transform_ai_action().
|
private |
Definition at line 111 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 119 of file actions.cpp.
References is_gamestate_changed_.
Referenced by ai::move_result::do_execute(), wfl::attack_callable::execute_self(), wfl::move_callable::execute_self(), wfl::move_partial_callable::execute_self(), wfl::recall_callable::execute_self(), wfl::recruit_callable::execute_self(), and ai::transform_ai_action().
bool ai::action_result::is_ok | ( | ) |
Definition at line 124 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(), execute(), ai::default_recruitment::recruitment::execute(), ai::default_recruitment::recruitment::execute_recall(), ai::default_recruitment::recruitment::execute_recruit(), wfl::attack_callable::execute_self(), wfl::move_callable::execute_self(), wfl::move_partial_callable::execute_self(), wfl::recall_callable::execute_self(), wfl::recruit_callable::execute_self(), and ai::transform_ai_action().
|
protected |
Definition at line 153 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().
|
protected |
Definition at line 130 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 143 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(), and ai::synced_command_result::do_execute().
|
private |
|
friend |
Definition at line 1122 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 123 of file actions.hpp.
Referenced by execute(), and is_execution().
|
private |
Definition at line 125 of file actions.hpp.
Referenced by init_for_execution(), is_gamestate_changed(), and set_gamestate_changed().
|
private |
Definition at line 114 of file actions.hpp.
Referenced by init_for_execution(), is_ok(), and ~action_result().
|
private |
Definition at line 117 of file actions.hpp.
Referenced by get_my_team(), and get_side().
|
private |
Definition at line 120 of file actions.hpp.
Referenced by get_status(), init_for_execution(), is_success(), and set_error().