27 #define DBG_AI_ASPECT LOG_STREAM(debug, log_ai_aspect) 28 #define LOG_AI_ASPECT LOG_STREAM(info, log_ai_aspect) 29 #define WRN_AI_ASPECT LOG_STREAM(warn, log_ai_aspect) 30 #define ERR_AI_ASPECT LOG_STREAM(err, log_ai_aspect) 33 time_of_day_(cfg[
"time_of_day"]),turns_(cfg[
"turns"]),
34 valid_(false), valid_variant_(false), valid_lua_(false), cfg_(cfg),
35 invalidate_on_turn_start_(cfg[
"invalidate_on_turn_start"].to_bool(true)),
36 invalidate_on_tod_change_(cfg[
"invalidate_on_tod_change"].to_bool(true)),
37 invalidate_on_gamestate_change_(cfg[
"invalidate_on_gamestate_change"].to_bool()),
38 engine_(cfg[
"engine"]), name_(cfg[
"name"]), id_(id)
91 name_ = cfg[
"name"].str();
92 id_ = cfg[
"id"].str();
150 if (s.find_first_of(
'"') == std::string::npos) {
151 return '"' + s +
'"';
152 }
else if (s.find_first_of(
"'") == std::string::npos) {
153 return "'" + s +
"'";
155 return "[=====[" + s +
"]=====]";
162 if (get_list().find(name) != get_list().end()) {
163 ERR_AI_ASPECT <<
"Error: Attempt to double-register aspect " << name;
bool invalidate_on_tod_change_
static lg::log_domain log_ai_aspect("ai/aspect")
virtual bool is_active(const std::string &time_of_day, const std::string &turns) const override
static manager & get_singleton()
bool is_duplicate(const std::string &name)
void add_turn_started_observer(events::observer *event_observer)
Adds an observer of 'ai_turn_started' event.
virtual bool redeploy(const config &cfg, const std::string &id)
Class that manages AIs for all sides and manages AI redeployment.
void add_tod_changed_observer(events::observer *event_observer)
Adds an observer of 'ai_tod_changed' event.
virtual bool delete_all_facets()
A small explanation about what's going on here: Each action has access to two game_info objects First...
void remove_gamestate_observer(events::observer *event_observer)
Removes an observer of game events except ai_user_interact event and ai_sync_network event...
void remove_turn_started_observer(events::observer *event_observer)
Deletes an observer of 'ai_turn_started' event.
static lg::log_domain & log()
static std::string quote_string(const std::string &s)
known_aspect(const std::string &name)
Managing the AIs lifecycle - headers TODO: Refactor history handling and internal commands...
virtual config to_config() const
aspect(readonly_context &context, const config &cfg, const std::string &id)
bool invalidate_on_turn_start_
const std::string & get_name() const
static map_location::DIRECTION s
void remove_tod_changed_observer(events::observer *event_observer)
Deletes an observer of 'ai_tod_changed' event.
virtual bool active() const
void add_gamestate_observer(events::observer *event_observer)
Adds observer of game events except ai_user_interact event and ai_sync_network event.
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
bool invalidate_on_gamestate_change_
void init_readonly_context_proxy(readonly_context &target)