#include <actions.hpp>
Public Types | |
enum | tresult { E_NOT_AVAILABLE_FOR_RECRUITING = 3001, E_UNKNOWN_OR_DUMMY_UNIT_TYPE = 3002, E_NO_GOLD = 3003, E_NO_LEADER = 3004, E_LEADER_NOT_ON_KEEP = 3005, E_BAD_RECRUIT_LOCATION = 3006 } |
Public Types inherited from ai::action_result | |
enum | tresult { AI_ACTION_SUCCESS = 0, AI_ACTION_STARTED = 1, AI_ACTION_FAILURE = -1 } |
Public Member Functions | |
recruit_result (side_number side, const std::string &unit_name, const map_location &where, const map_location &from) | |
virtual std::string | do_describe () const |
Public Member Functions inherited from ai::action_result | |
virtual | ~action_result () |
void | check_before () |
void | execute () |
bool | is_gamestate_changed () const |
bool | is_ok () |
int | get_status () const |
Protected Member Functions | |
virtual void | do_check_before () |
virtual void | do_check_after () |
virtual void | do_execute () |
virtual void | do_init_for_execution () |
Protected Member Functions inherited from ai::action_result | |
action_result (side_number side) | |
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 | |
const unit_type * | get_unit_type_known (const std::string &recruit) |
bool | test_enough_gold (const team &my_team, const unit_type &type) |
Private Attributes | |
const std::string & | unit_name_ |
const map_location & | where_ |
map_location | recruit_location_ |
map_location | recruit_from_ |
bool | location_checked_ |
Definition at line 238 of file actions.hpp.
Enumerator | |
---|---|
E_NOT_AVAILABLE_FOR_RECRUITING | |
E_UNKNOWN_OR_DUMMY_UNIT_TYPE | |
E_NO_GOLD | |
E_NO_LEADER | |
E_LEADER_NOT_ON_KEEP | |
E_BAD_RECRUIT_LOCATION |
Definition at line 242 of file actions.hpp.
ai::recruit_result::recruit_result | ( | side_number | side, |
const std::string & | unit_name, | ||
const map_location & | where, | ||
const map_location & | from | ||
) |
Definition at line 677 of file actions.cpp.
|
protectedvirtual |
Implements ai::action_result.
Definition at line 752 of file actions.cpp.
References ai::action_result::AI_ACTION_FAILURE, unit_map::find(), resources::gameboard, ai::action_result::get_side(), recruit_location_, ai::action_result::set_error(), and resources::units.
|
protectedvirtual |
Implements ai::action_result.
Definition at line 707 of file actions.cpp.
References actions::check_recruit_location(), E_BAD_RECRUIT_LOCATION, E_LEADER_NOT_ON_KEEP, E_NO_LEADER, ai::action_result::get_my_team(), ai::action_result::get_side(), get_unit_type_known(), location_checked_, LOG_AI_ACTIONS, actions::RECRUIT_ALTERNATE_LOCATION, recruit_from_, recruit_location_, actions::RECRUIT_NO_ABLE_LEADER, actions::RECRUIT_NO_KEEP_LEADER, actions::RECRUIT_NO_LEADER, actions::RECRUIT_NO_VACANCY, actions::RECRUIT_OK, ai::action_result::set_error(), test_enough_gold(), unit_name_, and map_location::valid().
|
virtual |
Implements ai::action_result.
Definition at line 770 of file actions.cpp.
References ai::action_result::get_side(), map_location::null_location(), unit_name_, and where_.
Referenced by operator<<().
|
protectedvirtual |
Implements ai::action_result.
Definition at line 785 of file actions.cpp.
References DBG_AI_ACTIONS, unit_type_data::find(), replay_helper::get_recruit(), ai::action_result::get_side(), unit_type::id(), ai::action_result::is_ok(), ai::action_result::is_success(), location_checked_, LOG_AI_ACTIONS, ai::manager::raise_gamestate_changed(), recruit_from_, recruit_location_, synced_context::run_in_synced_context_if_not_already(), ai::action_result::set_gamestate_changed(), preferences::show_ai_moves(), ai::action_result::sim_gamestate_changed, ai::simulated_recruit(), resources::simulation_, unit_name_, and unit_types.
|
protectedvirtual |
Implements ai::action_result.
Definition at line 820 of file actions.cpp.
|
private |
Definition at line 688 of file actions.cpp.
References E_UNKNOWN_OR_DUMMY_UNIT_TYPE, unit_type_data::find(), ai::action_result::set_error(), and unit_types.
Referenced by do_check_before().
Definition at line 698 of file actions.cpp.
References unit_type::cost(), E_NO_GOLD, team::gold(), and ai::action_result::set_error().
Referenced by do_check_before().
|
private |
Definition at line 268 of file actions.hpp.
Referenced by do_check_before(), and do_execute().
|
private |
Definition at line 267 of file actions.hpp.
Referenced by do_check_before(), and do_execute().
|
private |
Definition at line 266 of file actions.hpp.
Referenced by do_check_after(), do_check_before(), and do_execute().
|
private |
Definition at line 264 of file actions.hpp.
Referenced by do_check_before(), do_describe(), and do_execute().
|
private |
Definition at line 265 of file actions.hpp.
Referenced by do_describe().