33 #define LOG_AI LOG_STREAM(info, log_formula_ai) 34 #define WRN_AI LOG_STREAM(warn, log_formula_ai) 35 #define ERR_AI LOG_STREAM(err, log_formula_ai) 43 :
stage(context,cfg), fai_(fai)
63 if (
i->formula_manager().has_formula() ||
i->formula_manager().has_loop_formula()) {
65 if (
i->formula_manager().has_priority_formula()) {
68 if (priority_formula) {
73 WRN_AI <<
"priority formula skipped, maybe it's empty or incorrect"<< std::endl;
78 fai_.
handle_exception( e,
"Unit priority formula error for unit: '" +
i->type_id() +
"' standing at (" + std::to_string(
i->get_location().wml_x()) +
"," + std::to_string(
i->get_location().wml_y()) +
")");
83 ERR_AI <<
"formula type error while evaluating unit priority formula " << e.
message << std::endl;
98 if (i->formula_manager().has_formula()) {
103 callable.
add(
"me",
wfl::variant(std::make_shared<wfl::unit_callable>(*i)));
106 WRN_AI <<
"unit formula skipped, maybe it's empty or incorrect" << std::endl;
113 fai_.
handle_exception( e,
"Unit formula error for unit: '" + i->type_id() +
"' standing at (" + std::to_string(i->get_location().wml_x()) +
"," + std::to_string(i->get_location().wml_y()) +
")");
119 if (i->formula_manager().has_loop_formula())
125 callable.
add(
"me",
wfl::variant(std::make_shared<wfl::unit_callable>(*i)));
130 WRN_AI <<
"Loop formula skipped, maybe it's empty or incorrect" << std::endl;
136 fai_.
handle_exception( e,
"Unit loop formula error for unit: '" + i->type_id() +
"' standing at (" + std::to_string(i->get_location().wml_x()) +
"," + std::to_string(i->get_location().wml_y()) +
")");
virtual const unit_map & units() const override
std::multiset< unit_formula_pair, unit_formula_compare > unit_formula_set
A small explanation about what's going on here: Each action has access to two game_info objects First...
virtual side_number get_side() const override
Get the side number.
std::shared_ptr< const formula > const_formula_ptr
virtual config to_config() const
serialize
std::pair< unit_map::unit_iterator, int > unit_formula_pair
static const struct @6 priority[]
Standard logging facilities (interface).
Container associating units to locations.
A config object defines a single node in a WML file, with access to child nodes.
std::string::const_iterator iterator