Tweak shroud revealing logic

The per-actor visibility now tracks all cells
inside the map area (including those outside the
currently visible bounds), but the shroud/fog is
only cleared if the cell is inside the currently
visible bounds.
This commit is contained in:
Paul Chote
2015-06-11 22:00:49 +01:00
parent 6e052d19d9
commit da3abb4e2e
2 changed files with 19 additions and 6 deletions

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Traits
var limit = radius.RangeSquared;
var pos = map.CenterOfCell(position);
foreach (var cell in map.FindTilesInCircle(position, r))
foreach (var cell in map.FindTilesInCircle(position, r, true))
if ((map.CenterOfCell(cell) - pos).HorizontalLengthSquared <= limit)
yield return cell;
}
@@ -129,6 +129,11 @@ namespace OpenRA.Traits
foreach (var c in visible)
{
var uv = c.ToMPos(map);
// Force cells outside the visible bounds invisible
if (!map.Contains(uv))
continue;
visibleCount[uv]++;
explored[uv] = true;
}
@@ -147,7 +152,11 @@ namespace OpenRA.Traits
return;
foreach (var c in visible)
visibleCount[c.ToMPos(map)]--;
{
// Cells outside the visible bounds don't increment visibleCount
if (map.Contains(c))
visibleCount[c.ToMPos(map)]--;
}
visibility.Remove(a);
Invalidate(visible);