Remove region assumptions from fast shroud tests.

This commit is contained in:
Paul Chote
2015-05-03 19:28:07 +12:00
parent da3abb4e2e
commit aee951c86f
7 changed files with 66 additions and 49 deletions

View File

@@ -42,12 +42,16 @@ namespace OpenRA.Traits
public bool NeedRenderables;
public bool IsRendering { get; private set; }
public FrozenActor(Actor self, MPos[] footprint, CellRegion footprintRegion, Shroud shroud)
public FrozenActor(Actor self, MPos[] footprint, Shroud shroud)
{
actor = self;
isVisibleTest = shroud.IsVisibleTest(footprintRegion);
isVisibleTest = shroud.IsVisibleTest;
// Consider all cells inside the map area (ignoring the current map bounds)
Footprint = footprint
.Where(m => shroud.Contains(m))
.ToArray();
Footprint = footprint;
CenterPosition = self.CenterPosition;
Bounds = self.Bounds;
@@ -80,11 +84,13 @@ namespace OpenRA.Traits
// Visible = !Footprint.Any(isVisibleTest);
Visible = true;
foreach (var uv in Footprint)
{
if (isVisibleTest(uv))
{
Visible = false;
break;
}
}
if (Visible && !wasVisible)
NeedRenderables = true;