15 #define GETTEXT_DOMAIN "wesnoth-lib"
35 #include "formula/callable_objects.hpp"
39 #define ERR_NG LOG_STREAM(err, log_engine_sf)
45 #pragma warning(disable:4413)
47 : cfg_(
vconfig::unconstructed_vconfig())
68 : cfg_(
vconfig::empty_vconfig()), flat_(flat_tod), side_string_(side_string), fc_(fc)
79 result.push_back(
t.side());
90 std::vector<std::pair<int,int> >::const_iterator
range, range_end = ranges.end();
91 for (range = ranges.begin(); range != range_end; ++
range) {
92 if(side_number >= range->first && side_number <= range->second) {
120 if (!cfg_team_name.
blank()) {
124 if(
std::find(this_team_name.begin(), this_team_name.end(),
',') == this_team_name.end()) {
125 if(this_team_name != that_team_name)
return false;
128 const std::vector<std::string>& these_team_names =
utils::split(this_team_name);
129 bool search_futile =
true;
130 for(
const std::string& this_single_team_name : these_team_names) {
131 if(this_single_team_name == that_team_name) {
132 search_futile =
false;
136 if(search_futile)
return false;
147 if (u.side() != t.
side()) {
155 if(!found && ufilt_cfg[
"search_recall_list"].to_bool(
false)) {
170 if(!enemy_of.
null()) {
174 if(teams.empty())
return false;
175 for(
const int side : teams) {
182 if(!allied_with.
null()) {
186 if(teams.empty())
return false;
187 for(
const int side : teams) {
194 if(!has_enemy.
null()) {
199 for(
const int side : teams) {
206 if (!found)
return false;
210 if(!has_ally.
null()) {
215 for(
const int side : teams) {
222 if (!found)
return false;
227 if (!cfg_controller.
blank())
230 ERR_NG <<
"ignoring controller= in SSF due to danger of OOS errors" << std::endl;
248 const team_callable callable(t);
277 while (cond != cond_end) {
282 if(cond_name ==
"and")
287 else if(cond_name ==
"or")
292 else if(cond_name ==
"not")
std::vector< int > get_teams() const
play_controller * controller
static lg::log_domain log_engine_sf("engine/side_filter")
virtual const display_context & get_disp_context() const =0
boost::scoped_ptr< side_filter > enemy_filter_
const filter_context * fc_
The filter context for this filter. It should be a pointer because otherwise the default ctor doesn't...
bool match(const team &t) const
vconfig get_child() const
vconfig child(const std::string &key) const
Returns a child of *this whose key is key.
all_children_iterator ordered_end() const
Definitions for the interface to Wesnoth Markup Language (WML).
Variant for storing WML attributes.
bool blank() const
Tests for an attribute that was never set.
static std::vector< team > *& teams
This class stores all the data for a single 'side' (in game nomenclature).
bool has_child(const std::string &key) const
Returns whether or not *this has a child whose key is key.
const std::string & team_name() const
virtual const unit_map & units() const =0
const std::string & save_id() const
boost::scoped_ptr< side_filter > allied_filter_
virtual const std::vector< team > & teams() const =0
std::stringstream & wml_error()
Use this logger to send errors due to deprecated WML.
boost::scoped_ptr< unit_filter > ufilter_
std::vector< std::pair< int, int > > parse_ranges(std::string const &str)
bool match_internal(const team &t) const
boost::scoped_ptr< side_filter > has_ally_filter_
CONTROLLER controller() const
size_t find_index(const std::string &unit_id) const
Find the index of a unit by its id.
boost::scoped_ptr< side_filter > has_enemy_filter_
bool find(E event, F functor)
Tests whether an event handler is available.
static bool check_side_number(const team &t, const std::string &str)
static int cond(LexState *ls)
A variable-expanding proxy for the config class.
Standard logging facilities (interface).
recall_list_manager & recall_list()
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
GLsizei const GLcharARB ** string
std::string get_key() const
bool has_attribute(const std::string &key) const
< Synonym for operator[]
all_children_iterator ordered_begin() const
In-order iteration over all children.
side_filter(const std::string &side_string, const filter_context *fc, bool flat_tod=false)