The Battle for Wesnoth  1.19.0-dev
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:

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

◆ result

Enumerator
AI_ACTION_SUCCESS 
AI_ACTION_STARTED 
AI_ACTION_FAILURE 

Definition at line 43 of file actions.hpp.

Constructor & Destructor Documentation

◆ ~action_result()

ai::action_result::~action_result ( )
virtual

Definition at line 75 of file actions.cpp.

References DBG_AI_ACTIONS, and return_value_checked_.

◆ action_result()

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

Definition at line 70 of file actions.cpp.

Member Function Documentation

◆ check_after()

void ai::action_result::check_after ( )
private

Definition at line 82 of file actions.cpp.

References do_check_after().

Referenced by execute().

◆ check_before()

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().

◆ do_check_after()

virtual void ai::action_result::do_check_after ( )
protectedpure virtual

◆ do_check_before()

virtual void ai::action_result::do_check_before ( )
protectedpure virtual

◆ do_describe()

virtual std::string ai::action_result::do_describe ( ) const
pure virtual

◆ do_execute()

virtual void ai::action_result::do_execute ( )
protectedpure virtual

◆ do_init_for_execution()

virtual void ai::action_result::do_init_for_execution ( )
protectedpure virtual

◆ execute()

void ai::action_result::execute ( )

◆ get_info()

game_info & ai::action_result::get_info ( ) const
protected

◆ get_my_team()

team & ai::action_result::get_my_team ( ) const
protected

◆ get_side()

int ai::action_result::get_side ( ) const
inlineprotected

◆ get_status()

int ai::action_result::get_status ( ) const

◆ init_for_execution()

void ai::action_result::init_for_execution ( )
private

◆ is_execution()

bool ai::action_result::is_execution ( ) const
protected

Definition at line 158 of file actions.cpp.

References is_execution_.

Referenced by set_error().

◆ is_gamestate_changed()

bool ai::action_result::is_gamestate_changed ( ) const

◆ is_ok()

bool ai::action_result::is_ok ( )

◆ is_success()

bool ai::action_result::is_success ( ) const
protected

◆ set_error()

void ai::action_result::set_error ( int  error_code,
bool  log_as_error = true 
)
protected

◆ set_gamestate_changed()

void ai::action_result::set_gamestate_changed ( )
protected

◆ set_ok_checked()

void ai::action_result::set_ok_checked ( )
private

Friends And Related Function Documentation

◆ sim_gamestate_changed

void sim_gamestate_changed ( action_result result,
bool  gamestate_changed 
)
friend

Member Data Documentation

◆ is_execution_

bool ai::action_result::is_execution_
private

Definition at line 123 of file actions.hpp.

Referenced by execute(), and is_execution().

◆ is_gamestate_changed_

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().

◆ return_value_checked_

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().

◆ side_

int ai::action_result::side_
private

Definition at line 117 of file actions.hpp.

Referenced by get_my_team(), and get_side().

◆ status_

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: