Generate shroud cells outside the map.
This commit is contained in:
@@ -19,6 +19,7 @@ namespace OpenRA
|
|||||||
public class CellLayer<T> : IEnumerable<T>
|
public class CellLayer<T> : IEnumerable<T>
|
||||||
{
|
{
|
||||||
public readonly Size Size;
|
public readonly Size Size;
|
||||||
|
readonly Rectangle bounds;
|
||||||
public readonly TileShape Shape;
|
public readonly TileShape Shape;
|
||||||
public event Action<CPos> CellEntryChanged = null;
|
public event Action<CPos> CellEntryChanged = null;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ namespace OpenRA
|
|||||||
public CellLayer(TileShape shape, Size size)
|
public CellLayer(TileShape shape, Size size)
|
||||||
{
|
{
|
||||||
Size = size;
|
Size = size;
|
||||||
|
bounds = new Rectangle(0, 0, Size.Width, Size.Height);
|
||||||
Shape = shape;
|
Shape = shape;
|
||||||
entries = new T[size.Width * size.Height];
|
entries = new T[size.Width * size.Height];
|
||||||
}
|
}
|
||||||
@@ -122,6 +124,11 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Contains(MPos uv)
|
||||||
|
{
|
||||||
|
return bounds.Contains(uv.U, uv.V);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var cell in cellsAndNeighborsDirty)
|
foreach (var cell in cellsAndNeighborsDirty)
|
||||||
{
|
{
|
||||||
var uv = cell.ToMPos(map.TileShape);
|
var uv = cell.ToMPos(map.TileShape);
|
||||||
if (!map.Contains(uv))
|
if (!tileInfos.Contains(uv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var tileInfo = tileInfos[uv];
|
var tileInfo = tileInfos[uv];
|
||||||
|
|||||||
Reference in New Issue
Block a user