Generate shroud cells outside the map.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user