#include <contexts.hpp>

Public Member Functions | |
| virtual readwrite_context & | get_readwrite_context () |
| Unwrap - this class is not a proxy, so return *this. More... | |
| 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,. More... | |
| virtual move_result_ptr | execute_move_action (const map_location &from, const map_location &to, bool remove_movement=true, bool unreach_is_ok=false) |
| Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| virtual synced_command_result_ptr | execute_synced_command_action (const std::string &lua_code, const map_location &location=map_location::null_location()) |
| Ask the game to run Lua code. More... | |
| virtual team & | current_team_w () |
| Return a reference to the 'team' object for the AI. More... | |
| void | raise_gamestate_changed () const |
| Notifies all interested observers of the event respectively. More... | |
| readwrite_context_impl (readonly_context &context, const config &) | |
| Constructor. More... | |
| virtual | ~readwrite_context_impl () |
| virtual game_info & | get_info_w () |
| Functions to retrieve the 'info' object. More... | |
| virtual int | get_recursion_count () const |
| Get the value of the recursion counter. More... | |
| virtual config | to_readwrite_context_config () const |
| serialize this context to config More... | |
Public Member Functions inherited from ai::readonly_context_proxy | |
| readonly_context_proxy () | |
| virtual | ~readonly_context_proxy () |
| void | init_readonly_context_proxy (readonly_context &target) |
| virtual readonly_context & | get_readonly_context () |
| virtual void | on_readonly_context_create () |
| virtual const team & | current_team () const |
| virtual void | diagnostic (const std::string &msg) |
| virtual void | log_message (const std::string &msg) |
| virtual attack_result_ptr | check_attack_action (const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon) |
| virtual move_result_ptr | check_move_action (const map_location &from, const map_location &to, bool remove_movement=true, bool unreach_is_ok=false) |
| virtual recall_result_ptr | check_recall_action (const std::string &id, const map_location &where=map_location::null_location(), const map_location &from=map_location::null_location()) |
| virtual recruit_result_ptr | check_recruit_action (const std::string &unit_name, const map_location &where=map_location::null_location(), const map_location &from=map_location::null_location()) |
| virtual stopunit_result_ptr | check_stopunit_action (const map_location &unit_location, bool remove_movement=true, bool remove_attacks=false) |
| virtual synced_command_result_ptr | check_synced_command_action (const std::string &lua_code, const map_location &location=map_location::null_location()) |
| virtual void | calculate_possible_moves (std::map< map_location, pathfind::paths > &possible_moves, move_map &srcdst, move_map &dstsrc, bool enemy, bool assume_full_movement=false, const terrain_filter *remove_destinations=nullptr) const |
| virtual void | calculate_moves (const unit_map &units, std::map< map_location, pathfind::paths > &possible_moves, move_map &srcdst, move_map &dstsrc, bool enemy, bool assume_full_movement=false, const terrain_filter *remove_destinations=nullptr, bool see_all=false) const |
| virtual const game_info & | get_info () const |
| virtual void | raise_user_interact () const |
| defensive_position const & | best_defensive_position (const map_location &unit, const move_map &dstsrc, const move_map &srcdst, const move_map &enemy_dstsrc) const |
| virtual std::map< map_location, defensive_position > & | defensive_position_cache () const |
| virtual const unit_advancements_aspect & | get_advancements () const |
| virtual double | get_aggression () const |
| virtual int | get_attack_depth () const |
| virtual const aspect_map & | get_aspects () const |
| virtual aspect_map & | get_aspects () |
| virtual void | add_aspects (std::vector< aspect_ptr > &aspects) |
| virtual void | add_facet (const std::string &id, const config &cfg) const |
| virtual const attacks_vector & | get_attacks () const |
| virtual const variant & | get_attacks_as_variant () const |
| virtual const terrain_filter & | get_avoid () const |
| virtual double | get_caution () const |
| virtual const move_map & | get_dstsrc () const |
| virtual const move_map & | get_enemy_dstsrc () const |
| virtual const moves_map & | get_enemy_possible_moves () const |
| virtual const move_map & | get_enemy_srcdst () const |
| virtual engine_ptr | get_engine_by_cfg (const config &cfg) |
| get engine by cfg, creating it if it is not created yet but known More... | |
| virtual const std::vector < engine_ptr > & | get_engines () const |
| virtual std::vector< engine_ptr > & | get_engines () |
| virtual std::string | get_grouping () const |
| virtual const std::vector < goal_ptr > & | get_goals () const |
| virtual std::vector< goal_ptr > & | get_goals () |
| virtual double | get_leader_aggression () const |
| virtual config | get_leader_goal () const |
| virtual bool | get_leader_ignores_keep () const |
| virtual double | get_leader_value () const |
| virtual bool | get_passive_leader () const |
| virtual bool | get_passive_leader_shares_keep () const |
| virtual const moves_map & | get_possible_moves () const |
| virtual double | power_projection (const map_location &loc, const move_map &dstsrc) const |
| Function which finds how much 'power' a side can attack a certain location with. More... | |
| virtual const std::vector < unit_ptr > & | get_recall_list () const |
| virtual double | get_recruitment_diversity () const |
| virtual const config | get_recruitment_instructions () const |
| virtual const std::vector < std::string > | get_recruitment_more () const |
| virtual const std::vector < std::string > | get_recruitment_pattern () const |
| virtual int | get_recruitment_randomness () const |
| virtual const config | get_recruitment_save_gold () const |
| virtual const move_map & | get_srcdst () const |
| virtual double | get_scout_village_targeting () const |
| virtual bool | get_simple_targeting () const |
| virtual bool | get_support_villages () const |
| virtual double | get_village_value () const |
| virtual int | get_villages_per_scout () const |
| virtual bool | is_active (const std::string &time_of_day, const std::string &turns) const |
| virtual bool | is_dst_src_valid_lua () const |
| virtual bool | is_dst_src_enemy_valid_lua () const |
| virtual bool | is_src_dst_valid_lua () const |
| virtual bool | is_src_dst_enemy_valid_lua () const |
| virtual void | invalidate_defensive_position_cache () const |
| virtual void | invalidate_move_maps () const |
| virtual void | invalidate_keeps_cache () const |
| virtual const std::set < map_location > & | keeps () const |
| virtual bool | leader_can_reach_keep () const |
| virtual const map_location & | nearest_keep (const map_location &loc) const |
| virtual void | recalculate_move_maps () const |
| virtual void | recalculate_move_maps_enemy () const |
| virtual void | set_dst_src_valid_lua () |
| virtual void | set_dst_src_enemy_valid_lua () |
| virtual void | set_src_dst_valid_lua () |
| virtual void | set_src_dst_enemy_valid_lua () |
| virtual const map_location & | suitable_keep (const map_location &leader_location, const pathfind::paths &leader_paths) |
| get most suitable keep for leader - nearest free that can be reached in 1 turn, if none - return nearest occupied that can be reached in 1 turn, if none - return nearest keep, if none - return null_location More... | |
| virtual config | to_readonly_context_config () const |
| serialize to config More... | |
| virtual unit_stats_cache_t & | unit_stats_cache () const |
Public Member Functions inherited from ai::readonly_context | |
| readonly_context () | |
| virtual | ~readonly_context () |
Public Member Functions inherited from ai::side_context | |
| virtual | ~side_context () |
| empty destructor More... | |
| side_context () | |
| empty constructor More... | |
Public Member Functions inherited from ai::side_context_proxy | |
| side_context_proxy () | |
| virtual | ~side_context_proxy () |
| void | init_side_context_proxy (side_context &target) |
| virtual side_number | get_side () const |
| Get the side number. More... | |
| virtual void | set_side (side_number side) |
| Set the side number. More... | |
| virtual side_context & | get_side_context () |
| unwrap More... | |
| virtual config | to_side_context_config () const |
| serialize this context to config More... | |
Public Member Functions inherited from ai::readwrite_context | |
| readwrite_context () | |
| virtual | ~readwrite_context () |
Private Attributes | |
| recursion_counter | recursion_counter_ |
Additional Inherited Members | |
Public Types inherited from ai::readonly_context | |
| typedef std::map< std::pair < map_location, const unit_type * >, std::pair < battle_context_unit_stats, battle_context_unit_stats > > | unit_stats_cache_t |
Definition at line 1558 of file contexts.hpp.
|
inline |
Constructor.
Definition at line 1656 of file contexts.hpp.
References ai::readonly_context_proxy::init_readonly_context_proxy().
|
inlinevirtual |
Definition at line 1663 of file contexts.hpp.
|
virtual |
Return a reference to the 'team' object for the AI.
Implements ai::readwrite_context.
Definition at line 110 of file contexts.cpp.
References ai::side_context_proxy::get_side(), and resources::teams.
|
virtual |
Ask the game to attack an enemy defender using our unit attacker from attackers current location,.
| attacker_loc | location of attacker |
| defender_loc | location of defender |
| attacker_weapon | weapon of attacker |
| 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 115 of file contexts.cpp.
References ai::actions::execute_attack_action(), unit_map::find(), ai::readonly_context_proxy::get_advancements(), ai::readonly_context_proxy::get_aggression(), ai::readonly_context_proxy::get_leader_aggression(), ai::side_context_proxy::get_side(), i, resources::units, and unit_map::iterator_base< iter_types >::valid().
|
virtual |
Ask the game to move our unit from location 'from' to location 'to', optionally - doing a partial move.
| from | location of our unit |
| to | where to move |
| remove_movement | set unit movement to 0 in case of successful move |
| possible | result: ok |
| possible | result: something wrong |
| possible | result: move is interrupted |
| possible | result: move is impossible |
Implements ai::readwrite_context.
Definition at line 131 of file contexts.cpp.
References ai::actions::execute_move_action(), and ai::side_context_proxy::get_side().
|
virtual |
Ask the game to recall a unit for us on specified location.
| id | the id of the unit to be recalled. |
| where | location where the unit is to be recalled. |
| 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 141 of file contexts.cpp.
References ai::actions::execute_recall_action(), and ai::side_context_proxy::get_side().
|
virtual |
Ask the game to recruit a unit for us on specified location.
| unit_name | the name of the unit to be recruited. |
| where | location where the unit is to be recruited. |
| 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 146 of file contexts.cpp.
References ai::actions::execute_recruit_action(), and ai::side_context_proxy::get_side().
|
virtual |
Ask the game to remove unit movements and/or attack.
| unit_location | the location of our unit |
| remove_movement | set remaining movements to 0 |
| remove_attacks | set remaining attacks to 0 |
| possible | result: ok |
| possible_result | something wrong |
| possible_result | nothing to do |
Implements ai::readwrite_context.
Definition at line 161 of file contexts.cpp.
References ai::actions::execute_stopunit_action(), and ai::side_context_proxy::get_side().
|
virtual |
Ask the game to run Lua code.
| lua_code | the code to be run |
| location | location to be passed to the code as x1/y1 |
| possible | result: ok |
| possible_result | something wrong |
| possible_result | nothing to do |
Implements ai::readwrite_context.
Definition at line 171 of file contexts.cpp.
References ai::actions::execute_synced_command_action(), and ai::side_context_proxy::get_side().
|
virtual |
Functions to retrieve the 'info' object.
Used by derived classes to discover all necessary game information.
Implements ai::readwrite_context.
Definition at line 327 of file contexts.cpp.
References ai::manager::get_active_ai_info_for_side(), and ai::side_context_proxy::get_side().
|
inlinevirtual |
Unwrap - this class is not a proxy, so return *this.
Implements ai::readwrite_context.
Definition at line 1563 of file contexts.hpp.
|
virtual |
Get the value of the recursion counter.
Reimplemented from ai::readonly_context_proxy.
Definition at line 92 of file contexts.cpp.
References ai::recursion_counter::get_count(), and recursion_counter_.
|
virtual |
Notifies all interested observers of the event respectively.
Implements ai::readwrite_context.
Definition at line 104 of file contexts.cpp.
References ai::manager::raise_gamestate_changed().
|
virtual |
serialize this context to config
Implements ai::readwrite_context.
Definition at line 290 of file contexts.cpp.
|
private |
Definition at line 1680 of file contexts.hpp.
Referenced by get_recursion_count().
1.8.8