#include <aspect.hpp>
Public Member Functions | |
aspect (readonly_context &context, const config &cfg, const std::string &id) | |
virtual | ~aspect () |
void | invalidate () const |
virtual const variant & | get_variant () const =0 |
virtual boost::shared_ptr < variant > | get_variant_ptr () const =0 |
virtual void | recalculate () const =0 |
virtual void | on_create () |
virtual bool | redeploy (const config &cfg, const std::string &id) |
virtual config | to_config () const |
virtual bool | delete_all_facets () |
void | handle_generic_event (const std::string &) |
virtual bool | active () const |
virtual std::string | get_name () const |
virtual std::string | get_id () const |
virtual std::string | get_engine () const |
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 |
virtual int | get_recursion_count () const |
Get the value of the recursion counter. More... | |
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 events::observer | |
virtual | ~observer () |
Public Member Functions inherited from ai::component | |
component () | |
virtual | ~component () |
virtual component * | get_child (const path_element &child) |
virtual std::vector< component * > | get_children (const std::string &type) |
virtual std::vector< std::string > | get_children_types () |
virtual bool | change_child (const path_element &child, const config &cfg) |
virtual bool | add_child (const path_element &child, const config &cfg) |
virtual bool | delete_child (const path_element &child) |
property_handler_map & | property_handlers () |
Static Public Member Functions | |
static lg::log_domain & | log () |
Protected Attributes | |
std::string | time_of_day_ |
std::string | turns_ |
bool | valid_ |
bool | valid_variant_ |
bool | valid_lua_ |
config | cfg_ |
bool | invalidate_on_turn_start_ |
bool | invalidate_on_tod_change_ |
bool | invalidate_on_gamestate_change_ |
bool | invalidate_on_minor_gamestate_change_ |
std::string | engine_ |
std::string | name_ |
std::string | id_ |
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 42 of file aspect.hpp.
ai::aspect::aspect | ( | readonly_context & | context, |
const config & | cfg, | ||
const std::string & | id | ||
) |
Definition at line 31 of file aspect.cpp.
References DBG_AI_ASPECT, engine_, id_, ai::readonly_context_proxy::init_readonly_context_proxy(), name_, redeploy(), time_of_day_, and turns_.
|
virtual |
Definition at line 47 of file aspect.cpp.
References invalidate_on_gamestate_change_, invalidate_on_minor_gamestate_change_, invalidate_on_tod_change_, invalidate_on_turn_start_, ai::manager::remove_gamestate_observer(), ai::manager::remove_tod_changed_observer(), and ai::manager::remove_turn_started_observer().
|
virtual |
Definition at line 136 of file aspect.cpp.
References ai::readonly_context_proxy::is_active(), time_of_day_, and turns_.
|
virtual |
Reimplemented in ai::composite_aspect< T >.
Definition at line 141 of file aspect.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
Implemented in ai::typesafe_aspect< T >, ai::typesafe_aspect< config >, and ai::typesafe_aspect< attacks_vector >.
|
pure virtual |
Implemented in ai::typesafe_aspect< T >, ai::typesafe_aspect< config >, and ai::typesafe_aspect< attacks_vector >.
|
inlinevirtual |
|
inline |
Definition at line 48 of file aspect.hpp.
References valid_, valid_lua_, and valid_variant_.
Referenced by handle_generic_event().
|
static |
Definition at line 64 of file aspect.cpp.
References ai::log_ai_aspect.
Referenced by ai::typesafe_known_aspect< T >::add_facet(), ai::typesafe_known_aspect< T >::set(), and ai::standard_aspect< config >::standard_aspect().
|
virtual |
Definition at line 69 of file aspect.cpp.
|
pure virtual |
Implemented in ai::lua_aspect< T >, ai::standard_aspect< T >, ai::standard_aspect< config >, ai::composite_aspect< T >, ai::default_recruitment::recruitment_aspect, ai::typesafe_aspect< T >, ai::typesafe_aspect< config >, ai::typesafe_aspect< attacks_vector >, ai::aspect_attacks_lua, and ai::ai_default_rca::aspect_attacks_base.
|
virtual |
Definition at line 73 of file aspect.cpp.
References ai::manager::add_gamestate_observer(), ai::manager::add_tod_changed_observer(), ai::manager::add_turn_started_observer(), cfg_, DBG_AI_ASPECT, engine_, id_, invalidate_on_gamestate_change_, invalidate_on_minor_gamestate_change_, invalidate_on_tod_change_, invalidate_on_turn_start_, name_, ai::manager::remove_gamestate_observer(), ai::manager::remove_tod_changed_observer(), ai::manager::remove_turn_started_observer(), valid_, valid_lua_, and valid_variant_.
Referenced by aspect().
|
virtual |
Reimplemented in ai::lua_aspect< T >, ai::standard_aspect< T >, ai::standard_aspect< config >, ai::composite_aspect< T >, ai::aspect_attacks_lua, and ai::ai_default_rca::aspect_attacks.
Definition at line 117 of file aspect.cpp.
References engine_, id_, invalidate_on_gamestate_change_, invalidate_on_minor_gamestate_change_, invalidate_on_tod_change_, invalidate_on_turn_start_, name_, time_of_day_, and turns_.
Referenced by ai::ai_default_rca::aspect_attacks::to_config(), ai::aspect_attacks_lua::to_config(), ai::composite_aspect< T >::to_config(), ai::standard_aspect< config >::to_config(), and ai::lua_aspect< T >::to_config().
|
protected |
Definition at line 104 of file aspect.hpp.
Referenced by ai::composite_aspect< T >::composite_aspect(), redeploy(), and ai::standard_aspect< config >::standard_aspect().
|
protected |
Definition at line 109 of file aspect.hpp.
Referenced by aspect(), get_engine(), redeploy(), and to_config().
|
protected |
Definition at line 111 of file aspect.hpp.
Referenced by aspect(), get_id(), redeploy(), and to_config().
|
protected |
Definition at line 107 of file aspect.hpp.
Referenced by redeploy(), to_config(), and ~aspect().
|
protected |
Definition at line 108 of file aspect.hpp.
Referenced by redeploy(), to_config(), and ~aspect().
|
protected |
Definition at line 106 of file aspect.hpp.
Referenced by redeploy(), to_config(), and ~aspect().
|
protected |
Definition at line 105 of file aspect.hpp.
Referenced by redeploy(), to_config(), and ~aspect().
|
protected |
Definition at line 110 of file aspect.hpp.
Referenced by aspect(), ai::aspect_attacks_lua::aspect_attacks_lua(), get_name(), ai::lua_aspect< T >::lua_aspect(), redeploy(), ai::standard_aspect< config >::standard_aspect(), and to_config().
|
protected |
Definition at line 97 of file aspect.hpp.
Referenced by active(), aspect(), and to_config().
|
protected |
Definition at line 98 of file aspect.hpp.
Referenced by active(), aspect(), and to_config().
|
mutableprotected |
Definition at line 100 of file aspect.hpp.
Referenced by ai::typesafe_aspect< attacks_vector >::get_ptr(), ai::typesafe_aspect< attacks_vector >::get_variant_ptr(), invalidate(), ai::ai_default_rca::aspect_attacks_base::recalculate(), ai::default_recruitment::recruitment_aspect::recalculate(), ai::composite_aspect< T >::recalculate(), ai::standard_aspect< config >::recalculate(), and redeploy().
|
mutableprotected |
Definition at line 102 of file aspect.hpp.
Referenced by ai::typesafe_aspect< attacks_vector >::get_ptr(), ai::typesafe_aspect< attacks_vector >::get_variant_ptr(), invalidate(), ai::lua_aspect< T >::recalculate(), and redeploy().
|
mutableprotected |
Definition at line 101 of file aspect.hpp.
Referenced by ai::typesafe_aspect< attacks_vector >::get_ptr(), ai::typesafe_aspect< attacks_vector >::get_variant_ptr(), invalidate(), and redeploy().