27 #define DBG_AI_STAGE_RCA LOG_STREAM(debug, log_ai_stage_rca)
28 #define LOG_AI_STAGE_RCA LOG_STREAM(info, log_ai_stage_rca)
29 #define ERR_AI_STAGE_RCA LOG_STREAM(err, log_ai_stage_rca)
35 recursion_counter_(context.get_recursion_count()),
36 enabled_(cfg[
"enabled"].to_bool(true)), engine_(cfg[
"engine"]),
37 score_(cfg[
"score"].to_double(BAD_SCORE)),
38 max_score_(cfg[
"max_score"].to_double(HIGH_SCORE)),
39 id_(cfg[
"id"]), name_(cfg[
"name"]), type_(cfg[
"type"]), to_be_removed_(false)
131 ERR_AI_STAGE_RCA <<
"Error: Attempt to double-register candidate action " << name;
140 s <<
"candidate action with name ["<< ca.
get_name() <<
"]";
static factory_map & get_list()
bool is_duplicate(const std::string &name)
void enable()
Enable the candidate action.
std::shared_ptr< unit_filter > filter_own_
virtual void set_to_be_removed()
void disable()
Disable the candidate action.
candidate_action(rca_context &context, const config &cfg)
virtual ~candidate_action()
Destructor.
virtual bool to_be_removed()
static const double HIGH_SCORE
static const double BAD_SCORE
bool is_enabled() const
Is this candidate action enabled ?
int get_recursion_count() const
Get the value of the recursion counter.
virtual std::string get_name() const
Get the name of the candidate action (useful for debug purposes)
recursion_counter recursion_counter_
const std::string & get_type() const
Get the type of the candidate action (useful for debug purposes)
bool is_allowed_unit(const unit &u) const
Flag indicating whether unit may be used by this candidate action.
double get_max_score() const
Get the upper bound of the score of the candidate action without re-evaluation.
virtual config to_config() const
serialize
double get_score() const
Get the usual score of the candidate action without re-evaluation.
std::shared_ptr< unit_filter > get_filter_own() const
Get the unit filter for allowed units for this candidate action.
void init_rca_context_proxy(rca_context &target)
int get_count() const
Get the current value of the recursion counter.
A config object defines a single node in a WML file, with access to child nodes.
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
config & add_child(config_key_type key)
This class represents a single unit of a specific type.
A variable-expanding proxy for the config class.
const vconfig & make_safe() const
instruct the vconfig to make a private copy of its underlying data.
Standard logging facilities (interface).
A small explanation about what's going on here: Each action has access to two game_info objects First...
static lg::log_domain log_ai_stage_rca("ai/stage/rca")
std::ostream & operator<<(std::ostream &s, const ai::candidate_action &ca)
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
candidate action framework
static map_location::direction s