SUF: Fix $other_unit not being available in nested [and], [or], [not]

This commit is contained in:
Celtic Minstrel 2017-06-20 00:19:18 -04:00
parent a46468e3d3
commit d072661c94
2 changed files with 16 additions and 3 deletions

View file

@ -48,6 +48,7 @@ Version 1.13.8+dev:
* Fix some hotkeys not working (issues #1737 and #1769)
* New vision_cost and jamming_cost keys in SUF
* Integer SUF keys (eg level) now accept a list of ranges
* Fix $other_unit variable in SUF not being available in nested [and] [or] [not]
Version 1.13.8:
* Campaigns:

View file

@ -242,13 +242,25 @@ bool basic_unit_filter_impl::matches(const unit & u, const map_location& loc, co
for (size_t i = 0; i < cond_children_.size(); i++) {
switch (cond_child_types_[i].v) {
case conditional::TYPE::AND:
matches = matches && cond_children_[i].matches(u,loc);
if(u2) {
matches = matches && cond_children_[i].matches(u,loc,*u2);
} else {
matches = matches && cond_children_[i].matches(u,loc);
}
break;
case conditional::TYPE::OR:
matches = matches || cond_children_[i].matches(u,loc);
if(u2) {
matches = matches || cond_children_[i].matches(u,loc,*u2);
} else {
matches = matches || cond_children_[i].matches(u,loc);
}
break;
case conditional::TYPE::NOT:
matches = matches && !cond_children_[i].matches(u,loc);
if(u2) {
matches = matches && !cond_children_[i].matches(u,loc,*u2);
} else {
matches = matches && !cond_children_[i].matches(u,loc);
}
}
}
return matches;