introduced attribute in SSFs: team_name=
No comma-separated list support, must be contained in the (potentially comma-separated) team_name member variable in the team class. (should probably become a std::vector<std::string>...)
This commit is contained in:
parent
5207f3cb8a
commit
f176010b88
1 changed files with 21 additions and 0 deletions
|
@ -98,6 +98,27 @@ bool side_filter::match_internal(const team &t) const
|
|||
}
|
||||
}
|
||||
|
||||
config::attribute_value cfg_team_name = cfg_["team_name"];
|
||||
if (!cfg_team_name.blank()) {
|
||||
const std::string& that_team_name = cfg_team_name;
|
||||
const std::string& this_team_name = t.team_name();
|
||||
|
||||
if(std::find(this_team_name.begin(), this_team_name.end(), ',') == this_team_name.end()) {
|
||||
if(this_team_name != that_team_name) return false;
|
||||
}
|
||||
else {
|
||||
const std::vector<std::string>& these_team_names = utils::split(this_team_name);
|
||||
bool search_futile = true;
|
||||
foreach(const std::string& this_single_team_name, these_team_names) {
|
||||
if(this_single_team_name == that_team_name) {
|
||||
search_futile = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(search_futile) return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Allow filtering on units
|
||||
if(cfg_.has_child("has_unit")) {
|
||||
const vconfig& unit_filter = cfg_.child("has_unit");
|
||||
|
|
Loading…
Add table
Reference in a new issue