Skip to content

Commit

Permalink
fix unit filter always evaluating [and] even if it is not needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf authored and Vultraz committed May 31, 2018
1 parent 8c3673d commit af6559a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/units/filter.cpp
Expand Up @@ -244,17 +244,15 @@ bool unit_filter_compound::matches(const unit_filter_args& args) const

// Handle [and], [or], and [not] with in-order precedence
for(const auto & filter : cond_children_) {
bool child_res = filter.second.matches(args);

switch (filter.first.v) {
case CONDITIONAL_TYPE::AND:
res = res && child_res;
res = res && filter.second.matches(args);
break;
case CONDITIONAL_TYPE::OR:
res = res || child_res;
res = res || filter.second.matches(args);
break;
case CONDITIONAL_TYPE::NOT:
res = res && !child_res;
res = res && !filter.second.matches(args);
break;
}
}
Expand Down

0 comments on commit af6559a

Please sign in to comment.