Generate shroud cells outside the map.

This commit is contained in:
Paul Chote
2015-06-04 21:45:10 +01:00
parent cac7ec39f4
commit ec576558c0
2 changed files with 8 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ namespace OpenRA
public class CellLayer<T> : IEnumerable<T>
{
public readonly Size Size;
readonly Rectangle bounds;
public readonly TileShape Shape;
public event Action<CPos> CellEntryChanged = null;
@@ -30,6 +31,7 @@ namespace OpenRA
public CellLayer(TileShape shape, Size size)
{
Size = size;
bounds = new Rectangle(0, 0, Size.Width, Size.Height);
Shape = shape;
entries = new T[size.Width * size.Height];
}
@@ -122,6 +124,11 @@ namespace OpenRA
{
return GetEnumerator();
}
public bool Contains(MPos uv)
{
return bounds.Contains(uv.U, uv.V);
}
}
// Helper functions

View File

@@ -258,7 +258,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var cell in cellsAndNeighborsDirty)
{
var uv = cell.ToMPos(map.TileShape);
if (!map.Contains(uv))
if (!tileInfos.Contains(uv))
continue;
var tileInfo = tileInfos[uv];