From 2630537dafcc7e9c4bc12c064cea38554251efca Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 27 Mar 2015 17:34:35 +0000 Subject: [PATCH] Fix a mistake in Map.CellContaining. Fixes #6247. --- OpenRA.Game/Map/Map.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index fc479373e5..adb0245fe0 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -641,7 +641,7 @@ namespace OpenRA // - ax + by adds (a - b) * 512 + 512 to u // - ax + by adds (a + b) * 512 + 512 to v var z = Contains(cell) ? 512 * MapHeight.Value[cell] : 0; - return new WPos(512 * (cell.X - cell.Y + 1), 512 * (cell.X + cell.Y + 1), z); + return new WPos(512 * (cell.X - cell.Y), 512 * (cell.X + cell.Y + 1), z); } public WPos CenterOfSubCell(CPos cell, SubCell subCell) @@ -660,10 +660,10 @@ namespace OpenRA // Convert from world position to diamond cell position: // (a) Subtract (512, 512) to move the rotation center to the middle of the corner cell // (b) Rotate axes by -pi/4 - // (c) Add 512 to x (but not y) to realign the cell + // (c) Add (512, 512) to move back to the center of the cell // (d) Divide by 1024 to find final cell coords var u = (pos.Y + pos.X - 512) / 1024; - var v = (pos.Y - pos.X) / 1024; + var v = (pos.Y - pos.X - 512) / 1024; return new CPos(u, v); }