102 const std::string&
get_type()
const;
157 if (candidate_action_factories==
nullptr) {
160 return *candidate_action_factories;
171 get_list().emplace(name,ptr_to_this);
177 template<
class CANDIDATE_ACTION>
186 return std::make_shared<CANDIDATE_ACTION>(
ai, cfg);
static factory_map & get_list()
std::map< std::string, factory_ptr > factory_map
virtual candidate_action_ptr get_new_instance(rca_context &context, const config &cfg)=0
std::pair< const std::string, factory_ptr > factory_map_pair
bool is_duplicate(const std::string &name)
candidate_action_factory(const std::string &name)
virtual ~candidate_action_factory()
std::shared_ptr< candidate_action_factory > factory_ptr
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 std::string get_id() const
virtual ~candidate_action()
Destructor.
virtual bool to_be_removed()
static const double HIGH_SCORE
virtual std::string get_engine() const
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.
virtual double evaluate()=0
Evaluate the candidate action, resetting the internal state of the action.
virtual void execute()=0
Execute the 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.
register_candidate_action_factory(const std::string &name)
virtual candidate_action_ptr get_new_instance(rca_context &ai, const config &cfg)
A config object defines a single node in a WML file, with access to child nodes.
This class represents a single unit of a specific type.
A component of the AI framework.
A small explanation about what's going on here: Each action has access to two game_info objects First...
std::shared_ptr< candidate_action > candidate_action_ptr
std::ostream & operator<<(std::ostream &s, const ai::candidate_action &ca)
static map_location::direction s