80 : u(u), loc(loc), u2(u2), fc(fc), use_flat_tod(use_flat_tod)
94 template<
typename C,
typename F>
97 void create_child(
const vconfig& c, F func);
104 std::vector<std::shared_ptr<unit_filter_base>>
children_;
122 use_flat_tod_ = value;
140 bool matches(
const unit & u)
const;
146 bool matches(
const unit & u,
const unit & u2)
const;
149 return matches(u, loc);
157 return matches(u, loc, u2);
161 return matches(u, u2);
164 std::vector<const unit *> all_matches_on_map(
const map_location* loc =
nullptr,
const unit* other_unit =
nullptr)
const;
167 return all_matches_on_map(&loc);
171 return all_matches_on_map(
nullptr, &u);
175 return all_matches_on_map(&loc, &u);
181 return cfg_.get_config();
185 return cfg_.get_config().empty();
filter_error(const std::string &message="filter error")
const filter_context * fc_
This class represents a single unit of a specific type.
unit_filter & set_use_flat_tod(bool value)
Variant for storing WML attributes.
MAKE_ENUM(CONDITIONAL_TYPE,(AND, "and")(OR, "or")(NOT, "not"))
bool operator()(const unit &u, const map_location &loc) const
bool matches(const unit &u, const map_location &loc) const
Determine if *this matches filter at a specified location.
const filter_context & context() const
std::shared_ptr< const unit > unit_const_ptr
std::vector< const unit * > all_matches_with_unit(const unit &u) const
std::vector< const unit * > all_matches_with_unit_at(const unit &u, const map_location &loc) const
unit_filter_impl::unit_filter_compound impl_
bool operator()(const unit &u) const
bool operator()(const unit &u, const map_location &loc, const unit &u2) const
const filter_context * fc
Encapsulates the map of the game.
std::vector< std::shared_ptr< unit_filter_base > > children_
virtual ~unit_filter_base()
std::vector< std::pair< CONDITIONAL_TYPE, unit_filter_compound > > cond_children_
bool matches(const unit &u, const map_location &loc, const unit &u2) const
Base class for all the errors encountered by the engine.
A variable-expanding proxy for the config class.
bool operator()(const unit &u, const unit &u2) const
A config object defines a single node in a WML file, with access to child nodes.
Defines the MAKE_ENUM macro.
std::vector< const unit * > all_matches_at(const map_location &loc) const
unit_filter_args(const unit &u, map_location loc, const unit *u2, const filter_context *fc, bool use_flat_tod)