Fix [filter_wml] implementation so that [or] tags actually work
This commit is contained in:
parent
2b8782923a
commit
b483d96f50
1 changed files with 9 additions and 17 deletions
|
@ -1182,31 +1182,25 @@ bool config::matches(const config& filter) const
|
|||
{
|
||||
check_valid(filter);
|
||||
|
||||
bool result = true;
|
||||
|
||||
for(const attribute& i : filter.attribute_range()) {
|
||||
const attribute_value* v = get(i.first);
|
||||
if(!v || *v != i.second) {
|
||||
return false;
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(const any_child& i : filter.all_children_range()) {
|
||||
if(i.key == "not") {
|
||||
if(matches(i.cfg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result = result && !matches(i.cfg);
|
||||
continue;
|
||||
} else if(i.key == "and") {
|
||||
if(!matches(i.cfg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result = result && matches(i.cfg);
|
||||
continue;
|
||||
} else if(i.key == "or") {
|
||||
if(matches(i.cfg)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
result = result || matches(i.cfg);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1218,12 +1212,10 @@ bool config::matches(const config& filter) const
|
|||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
return false;
|
||||
}
|
||||
result = result && found;
|
||||
}
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string config::debug() const
|
||||
|
|
Loading…
Add table
Reference in a new issue