The Battle for Wesnoth  1.19.5+dev
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ai::recruit_result Class Reference

#include <actions.hpp>

Inheritance diagram for ai::recruit_result:

Public Types

enum  result {
  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  result { 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_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

const unit_typeget_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_locationwhere_
 
map_location recruit_location_
 
map_location recruit_from_
 
bool location_checked_
 

Detailed Description

Definition at line 234 of file actions.hpp.

Member Enumeration Documentation

◆ result

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 238 of file actions.hpp.

Constructor & Destructor Documentation

◆ recruit_result()

ai::recruit_result::recruit_result ( side_number  side,
const std::string &  unit_name,
const map_location where,
const map_location from 
)

Definition at line 665 of file actions.cpp.

Member Function Documentation

◆ do_check_after()

void ai::recruit_result::do_check_after ( )
protectedvirtual

◆ do_check_before()

void ai::recruit_result::do_check_before ( )
protectedvirtual

◆ do_describe()

std::string ai::recruit_result::do_describe ( ) const
virtual

Implements ai::action_result.

Definition at line 756 of file actions.cpp.

References ai::action_result::get_side(), map_location::null_location(), s, unit_name_, and where_.

Referenced by operator<<().

◆ do_execute()

void ai::recruit_result::do_execute ( )
protectedvirtual

◆ do_init_for_execution()

void ai::recruit_result::do_init_for_execution ( )
protectedvirtual

Implements ai::action_result.

Definition at line 804 of file actions.cpp.

◆ get_unit_type_known()

const unit_type * ai::recruit_result::get_unit_type_known ( const std::string &  recruit)
private

◆ test_enough_gold()

bool ai::recruit_result::test_enough_gold ( const team my_team,
const unit_type type 
)
private

Definition at line 686 of file actions.cpp.

References E_NO_GOLD, team::gold(), and ai::action_result::set_error().

Referenced by do_check_before().

Member Data Documentation

◆ location_checked_

bool ai::recruit_result::location_checked_
private

Definition at line 264 of file actions.hpp.

Referenced by do_check_before(), and do_execute().

◆ recruit_from_

map_location ai::recruit_result::recruit_from_
private

Definition at line 263 of file actions.hpp.

Referenced by do_check_before(), and do_execute().

◆ recruit_location_

map_location ai::recruit_result::recruit_location_
private

Definition at line 262 of file actions.hpp.

Referenced by do_check_after(), do_check_before(), and do_execute().

◆ unit_name_

const std::string& ai::recruit_result::unit_name_
private

Definition at line 260 of file actions.hpp.

Referenced by do_check_before(), do_describe(), and do_execute().

◆ where_

const map_location& ai::recruit_result::where_
private

Definition at line 261 of file actions.hpp.

Referenced by do_describe().


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