Introduce a new type for representing map coordinates.

To resolve the ambiguity introduced when the introduction of isometric maps meant that cell and map coordinates were no longer equivalent, a new type has been introduced so they can each be represented separately.
This commit is contained in:
RoosterDragon
2014-12-22 19:07:20 +00:00
parent 40c9d0a47d
commit 7cfece6dc0
21 changed files with 257 additions and 232 deletions

View File

@@ -133,9 +133,9 @@ namespace OpenRA.Widgets
{
var preview = Preview();
var tileShape = Game.ModData.Manifest.TileShape;
var point = Map.CellToMap(tileShape, cell);
var dx = (int)(previewScale * (point.X - preview.Bounds.Left));
var dy = (int)(previewScale * (point.Y - preview.Bounds.Top));
var point = cell.ToMPos(tileShape);
var dx = (int)(previewScale * (point.U - preview.Bounds.Left));
var dy = (int)(previewScale * (point.V - preview.Bounds.Top));
return new int2(mapRect.X + dx, mapRect.Y + dy);
}