Allow multiple sides (comma separared) to be specified in unit filters
This commit is contained in:
parent
323a46c99a
commit
2d3df0f406
1 changed files with 13 additions and 1 deletions
14
src/unit.cpp
14
src/unit.cpp
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue