Allow multiple sides (comma separared) to be specified in unit filters

This commit is contained in:
Benjamin Drieu 2004-04-12 22:21:22 +00:00
parent 323a46c99a
commit 2d3df0f406

View file

@ -440,7 +440,19 @@ bool unit::matches_filter(const config& cfg) const
return false;
if(side.empty() == false && this->side() != atoi(side.c_str()))
return false;
{
if(std::find(side.begin(),side.end(),',') != side.end()) {
const std::vector<std::string>& vals = config::split(side);
std::ostringstream s;
s << (this->side());
if(std::find(vals.begin(),vals.end(),s.str()) == vals.end()) {
return false;
}
} else {
return false;
}
}
if(weapon.empty() == false) {
bool has_weapon = false;