diff --git a/OpenRA.Game/Map/CellLayer.cs b/OpenRA.Game/Map/CellLayer.cs index 72c607fd2d..6f5112307e 100644 --- a/OpenRA.Game/Map/CellLayer.cs +++ b/OpenRA.Game/Map/CellLayer.cs @@ -19,6 +19,7 @@ namespace OpenRA public class CellLayer : IEnumerable { public readonly Size Size; + readonly Rectangle bounds; public readonly TileShape Shape; public event Action 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 diff --git a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs index fdd0fc1111..12b84a31be 100644 --- a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs @@ -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];