The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ai::action_result Class Referenceabstract

#include <actions.hpp>

Inheritance diagram for ai::action_result:
Inheritance graph

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_infoget_info () const
 
teamget_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)
 

Detailed Description

Definition at line 38 of file actions.hpp.

Member Enumeration Documentation

Enumerator
AI_ACTION_SUCCESS 
AI_ACTION_STARTED 
AI_ACTION_FAILURE 

Definition at line 43 of file actions.hpp.

Constructor & Destructor Documentation

ai::action_result::~action_result ( )
virtual

Definition at line 74 of file actions.cpp.

References DBG_AI_ACTIONS, and return_value_checked_.

ai::action_result::action_result ( side_number  side)
protected

Definition at line 69 of file actions.cpp.

Member Function Documentation

void ai::action_result::check_after ( )
private

Definition at line 81 of file actions.cpp.

References do_check_after().

Referenced by execute().

void ai::action_result::check_before ( )

Definition at line 86 of file actions.cpp.

References do_check_before().

Referenced by execute().

virtual void ai::action_result::do_check_after ( )
protectedpure virtual
virtual void ai::action_result::do_check_before ( )
protectedpure virtual
virtual std::string ai::action_result::do_describe ( ) const
pure virtual
virtual void ai::action_result::do_execute ( )
protectedpure virtual
virtual void ai::action_result::do_init_for_execution ( )
protectedpure virtual
void ai::action_result::execute ( )
game_info & ai::action_result::get_info ( ) const
protected

Definition at line 162 of file actions.cpp.

References ai::manager::get_active_ai_info_for_side(), and get_side().

Referenced by ai::attack_result::do_execute().

team & ai::action_result::get_my_team ( ) const
protected
int ai::action_result::get_side ( ) const
inlineprotected
int ai::action_result::get_status ( ) const

Definition at line 147 of file actions.cpp.

References status_.

void ai::action_result::init_for_execution ( )
private
bool ai::action_result::is_execution ( ) const
protected

Definition at line 157 of file actions.cpp.

References is_execution_.

Referenced by set_error().

bool ai::action_result::is_gamestate_changed ( ) const

Definition at line 118 of file actions.cpp.

References is_gamestate_changed_.

Referenced by ai::move_result::do_execute().

bool ai::action_result::is_ok ( )
bool ai::action_result::is_success ( ) const
protected
void ai::action_result::set_error ( int  error_code,
bool  log_as_error = true 
)
protected
void ai::action_result::set_gamestate_changed ( )
protected
void ai::action_result::set_ok_checked ( )
private

Friends And Related Function Documentation

void sim_gamestate_changed ( action_result result,
bool  gamestate_changed 
)
friend

Member Data Documentation

bool ai::action_result::is_execution_
private

Definition at line 123 of file actions.hpp.

Referenced by execute(), and is_execution().

bool ai::action_result::is_gamestate_changed_
private

Definition at line 125 of file actions.hpp.

Referenced by init_for_execution(), is_gamestate_changed(), and set_gamestate_changed().

bool ai::action_result::return_value_checked_
private

Definition at line 114 of file actions.hpp.

Referenced by init_for_execution(), is_ok(), and ~action_result().

int ai::action_result::side_
private

Definition at line 117 of file actions.hpp.

Referenced by get_my_team(), and get_side().

int ai::action_result::status_
private

Definition at line 120 of file actions.hpp.

Referenced by get_status(), init_for_execution(), is_success(), and set_error().


The documentation for this class was generated from the following files: