Browse files

Fix logic of [filter_vision] in Standard Unit Filters (SUFs)

Previously, the [filter_vision] tag would cause a false positive when a
unit was on terrain on which it was invisible and that also was under
fog/shroud.  There might have been other combinations that did not work
either, I did not check that.  I did check that all 8 combinations of
visble=yes/no, the unit hiding due to terrain or not, and the hex being
under fog/shroud or not work now.
  • Loading branch information...
1 parent 61fb0c0 commit 22dec61d3e1321934834f93f6376255305f0861c @mattsc mattsc committed Jan 17, 2014
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/unit.cpp
View
9 src/unit.cpp
@@ -1567,11 +1567,10 @@ bool unit::internal_matches_filter(const vconfig& cfg, const map_location& loc,
}
std::set<int>::const_iterator viewer, viewer_end = viewers.end();
for (viewer = viewers.begin(); viewer != viewer_end; ++viewer) {
- bool not_fogged = !teams_manager::get_teams()[*viewer - 1].fogged(loc);
- bool not_hiding = !this->invisible(loc/*, false(?) */);
- if (visible != not_fogged && not_hiding) {
- return false;
- }
+ bool fogged = teams_manager::get_teams()[*viewer - 1].fogged(loc);
+ bool hiding = this->invisible(loc/*, false(?) */);
+ bool unit_hidden = fogged || hiding;
+ if (visible == unit_hidden) return false;
}
}
}

0 comments on commit 22dec61

Please sign in to comment.