Fix a mistake in Map.CellContaining.

Fixes #6247.
This commit is contained in:
Paul Chote
2015-03-27 17:34:35 +00:00
parent 0d5588f08a
commit 2630537daf

View File

@@ -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);
}