Public Member Functions | Private Attributes

ai::readwrite_context_impl Class Reference

#include <contexts.hpp>

Inheritance diagram for ai::readwrite_context_impl:
Inheritance graph
[legend]
Collaboration diagram for ai::readwrite_context_impl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual readwrite_contextget_readwrite_context ()
 Unwrap - this class is not a proxy, so return *this.
virtual attack_result_ptr execute_attack_action (const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon)
 Ask the game to attack an enemy defender using our unit attacker from attackers current location,.
virtual move_result_ptr execute_move_action (const map_location &from, const map_location &to, bool remove_movement=true)
 Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move.
virtual recall_result_ptr execute_recall_action (const std::string &id, const map_location &where=map_location::null_location, const map_location &from=map_location::null_location)
 Ask the game to recall a unit for us on specified location.
virtual recruit_result_ptr execute_recruit_action (const std::string &unit_name, const map_location &where=map_location::null_location, const map_location &from=map_location::null_location)
 Ask the game to recruit a unit for us on specified location.
virtual stopunit_result_ptr execute_stopunit_action (const map_location &unit_location, bool remove_movement=true, bool remove_attacks=false)
 Ask the game to remove unit movements and/or attack.
virtual teamcurrent_team_w ()
 Return a reference to the 'team' object for the AI.
void raise_gamestate_changed () const
 Notifies all interested observers of the event respectively.
 readwrite_context_impl (readonly_context &context, const config &)
 Constructor.
virtual ~readwrite_context_impl ()
virtual game_infoget_info_w ()
 Functions to retrieve the 'info' object.
virtual int get_recursion_count () const
 Get the value of the recursion counter.
virtual config to_readwrite_context_config () const
 serialize this context to config

Private Attributes

recursion_counter recursion_counter_

Detailed Description

Definition at line 1482 of file contexts.hpp.


Constructor & Destructor Documentation

ai::readwrite_context_impl::readwrite_context_impl ( readonly_context context,
const config  
) [inline]

Constructor.

Definition at line 1569 of file contexts.hpp.

References ai::readonly_context_proxy::init_readonly_context_proxy().

Here is the call graph for this function:

virtual ai::readwrite_context_impl::~readwrite_context_impl (  )  [inline, virtual]

Definition at line 1576 of file contexts.hpp.


Member Function Documentation

team & ai::readwrite_context_impl::current_team_w (  )  [virtual]

Return a reference to the 'team' object for the AI.

Implements ai::readwrite_context.

Definition at line 85 of file contexts.cpp.

References ai::side_context_proxy::get_side(), and resources::teams.

Here is the call graph for this function:

attack_result_ptr ai::readwrite_context_impl::execute_attack_action ( const map_location attacker_loc,
const map_location defender_loc,
int  attacker_weapon 
) [virtual]

Ask the game to attack an enemy defender using our unit attacker from attackers current location,.

Parameters:
attacker_loc location of attacker
defender_loc location of defender
attacker_weapon weapon of attacker
Return values:
possible result: ok
possible result: something wrong
possible result: attacker and/or defender are invalid
possible result: attacker and/or defender are invalid
possible result: attacker doesn't have the specified weapon

Implements ai::readwrite_context.

Definition at line 90 of file contexts.cpp.

References unit_map::find(), ai::readonly_context_proxy::get_aggression(), ai::readonly_context_proxy::get_leader_aggression(), ai::side_context_proxy::get_side(), resources::units, and unit_map::iterator_base< iter_types >::valid().

Here is the call graph for this function:

move_result_ptr ai::readwrite_context_impl::execute_move_action ( const map_location from,
const map_location to,
bool  remove_movement = true 
) [virtual]

Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move.

Parameters:
from location of our unit
to where to move
remove_movement set unit movement to 0 in case of successful move
Return values:
possible result: ok
possible result: something wrong
possible result: move is interrupted
possible result: move is impossible

Implements ai::readwrite_context.

Definition at line 104 of file contexts.cpp.

References ai::side_context_proxy::get_side().

Here is the call graph for this function:

recall_result_ptr ai::readwrite_context_impl::execute_recall_action ( const std::string &  id,
const map_location where = map_location::null_location,
const map_location from = map_location::null_location 
) [virtual]

Ask the game to recall a unit for us on specified location.

Parameters:
id the id of the unit to be recalled.
where location where the unit is to be recalled.
Return values:
possible result: ok
possible_result,: something wrong
possible_result,: leader not on keep
possible_result,: no free space on keep
possible_result,: not enough gold

Implements ai::readwrite_context.

Definition at line 114 of file contexts.cpp.

References ai::side_context_proxy::get_side().

Here is the call graph for this function:

recruit_result_ptr ai::readwrite_context_impl::execute_recruit_action ( const std::string &  unit_name,
const map_location where = map_location::null_location,
const map_location from = map_location::null_location 
) [virtual]

Ask the game to recruit a unit for us on specified location.

Parameters:
unit_name the name of the unit to be recruited.
where location where the unit is to be recruited.
Return values:
possible result: ok
possible_result,: something wrong
possible_result,: leader not on keep
possible_result,: no free space on keep
possible_result,: not enough gold

Implements ai::readwrite_context.

Definition at line 119 of file contexts.cpp.

References ai::side_context_proxy::get_side().

Here is the call graph for this function:

stopunit_result_ptr ai::readwrite_context_impl::execute_stopunit_action ( const map_location unit_location,
bool  remove_movement = true,
bool  remove_attacks = false 
) [virtual]

Ask the game to remove unit movements and/or attack.

Parameters:
unit_location the location of our unit
remove_movement set remaining movements to 0
remove_attacks set remaining attacks to 0
Return values:
possible result: ok
possible_result,: something wrong
possible_result,: nothing to do

Implements ai::readwrite_context.

Definition at line 134 of file contexts.cpp.

References ai::side_context_proxy::get_side().

Here is the call graph for this function:

game_info & ai::readwrite_context_impl::get_info_w (  )  [virtual]

Functions to retrieve the 'info' object.

Used by derived classes to discover all necessary game information.

Implements ai::readwrite_context.

Definition at line 284 of file contexts.cpp.

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

Here is the call graph for this function:

virtual readwrite_context& ai::readwrite_context_impl::get_readwrite_context (  )  [inline, virtual]

Unwrap - this class is not a proxy, so return *this.

Implements ai::readwrite_context.

Definition at line 1487 of file contexts.hpp.

int ai::readwrite_context_impl::get_recursion_count (  )  const [virtual]

Get the value of the recursion counter.

Implements ai::side_context.

Definition at line 67 of file contexts.cpp.

References ai::recursion_counter::get_count(), and recursion_counter_.

Here is the call graph for this function:

void ai::readwrite_context_impl::raise_gamestate_changed (  )  const [virtual]

Notifies all interested observers of the event respectively.

Implements ai::readwrite_context.

Definition at line 79 of file contexts.cpp.

config ai::readwrite_context_impl::to_readwrite_context_config (  )  const [virtual]

serialize this context to config

Implements ai::readwrite_context.

Definition at line 247 of file contexts.cpp.


Member Data Documentation

Definition at line 1593 of file contexts.hpp.

Referenced by get_recursion_count().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:18:53 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs