Replace CPos.CenterPosition -> Map.CenterOfCell.

This commit is contained in:
Paul Chote
2013-09-17 22:27:19 +12:00
parent b6d1d26eeb
commit 7b52fa52b6
48 changed files with 105 additions and 90 deletions

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Traits
var c = render[cell];
if (c.Sprite != null)
new SpriteRenderable(c.Sprite, cell.CenterPosition,
new SpriteRenderable(c.Sprite, wr.world.Map.CenterOfCell(cell),
WVec.Zero, -511, c.Type.Palette, 1f, true).Render(wr);
}
}

View File

@@ -65,12 +65,13 @@ namespace OpenRA.Traits
static IEnumerable<CPos> FindVisibleTiles(World world, CPos position, WRange radius)
{
var map = world.Map;
var r = (radius.Range + 1023) / 1024;
var limit = radius.Range * radius.Range;
var pos = position.CenterPosition;
var pos = map.CenterOfCell(position);
foreach (var cell in world.Map.FindTilesInCircle(position, r))
if ((cell.CenterPosition - pos).HorizontalLengthSquared <= limit)
foreach (var cell in map.FindTilesInCircle(position, r))
if ((map.CenterOfCell(cell) - pos).HorizontalLengthSquared <= limit)
yield return cell;
}