From c7b4eff89a94710a63ae2318c26b626969fe8b85 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 3 Jan 2015 20:07:04 +0000 Subject: [PATCH] Ensure the whole path search cache is initialized. The region covered by map.Cells may not cover the whole map size, but we need the whole cache initialized so it can be used correctly when a different map is used, because that map may have the same size but a different offset which means a different region is covered. --- OpenRA.Mods.RA/Traits/World/PathSearch.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Traits/World/PathSearch.cs b/OpenRA.Mods.RA/Traits/World/PathSearch.cs index a9ba4518c2..cbc34378ee 100644 --- a/OpenRA.Mods.RA/Traits/World/PathSearch.cs +++ b/OpenRA.Mods.RA/Traits/World/PathSearch.cs @@ -332,8 +332,9 @@ namespace OpenRA.Mods.RA.Traits defaultCellInfoLayer.Shape != map.TileShape) { defaultCellInfoLayer = new CellLayer(map); - foreach (var uv in map.Cells.MapCoords) - defaultCellInfoLayer[uv.X, uv.Y] = new CellInfo(int.MaxValue, Map.MapToCell(map.TileShape, uv), false); + for (var v = 0; v < mapSize.Height; v++) + for (var u = 0; u < mapSize.Width; u++) + defaultCellInfoLayer[u, v] = new CellInfo(int.MaxValue, Map.MapToCell(map.TileShape, new CPos(u, v)), false); } result.CopyValuesFrom(defaultCellInfoLayer);