26 #define DBG_AI_ASPECT LOG_STREAM(debug, log_ai_aspect)
27 #define LOG_AI_ASPECT LOG_STREAM(info, log_ai_aspect)
28 #define WRN_AI_ASPECT LOG_STREAM(warn, log_ai_aspect)
29 #define ERR_AI_ASPECT LOG_STREAM(err, log_ai_aspect)
32 time_of_day_(cfg[
"time_of_day"]),turns_(cfg[
"turns"]),
33 valid_(false), valid_variant_(false), valid_lua_(false), cfg_(cfg),
34 invalidate_on_turn_start_(cfg[
"invalidate_on_turn_start"].to_bool(true)),
35 invalidate_on_tod_change_(cfg[
"invalidate_on_tod_change"].to_bool(true)),
36 invalidate_on_gamestate_change_(cfg[
"invalidate_on_gamestate_change"].to_bool()),
37 invalidate_on_minor_gamestate_change_(cfg[
"invalidate_on_minor_gamestate_change"].to_bool()),
38 engine_(cfg[
"engine"]), name_(cfg[
"name"]),
id_(id)
98 name_ = cfg[
"name"].str();
99 id_ = cfg[
"id"].str();
162 if (s.find_first_of(
'"') == std::string::npos) {
163 return '"' + s +
'"';
164 }
else if (s.find_first_of(
"'") == std::string::npos) {
165 return "'" + s +
"'";
167 return "[=====[" + s +
"]=====]";
175 ERR_AI_ASPECT <<
"Error: Attempt to double-register aspect " << name << std::endl;
virtual config to_config() const
bool invalidate_on_tod_change_
static lg::log_domain log_ai_aspect("ai/aspect")
const std::string & get_name() const
bool is_duplicate(const std::string &name)
bool invalidate_on_minor_gamestate_change_
static 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)
static void add_tod_changed_observer(events::observer *event_observer)
Adds an observer of 'ai_tod_changed' event.
virtual bool delete_all_facets()
virtual bool active() const
A small explanation about what's going on here: Each action has access to two game_info objects First...
static void remove_gamestate_observer(events::observer *event_observer)
Removes an observer of game events except ai_user_interact event and ai_sync_network event...
static 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.
virtual bool is_active(const std::string &time_of_day, const std::string &turns) const
aspect(readonly_context &context, const config &cfg, const std::string &id)
bool invalidate_on_turn_start_
static void remove_tod_changed_observer(events::observer *event_observer)
Deletes an observer of 'ai_tod_changed' event.
GLuint const GLchar * name
bool find(E event, F functor)
Tests whether an event handler is available.
static void add_gamestate_observer(events::observer *event_observer)
Adds observer of game events except ai_user_interact event and ai_sync_network event.
static factory_map & get_list()
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_
GLsizei const GLcharARB ** string
void init_readonly_context_proxy(readonly_context &target)