Kill Map.XOffset / Map.YOffset.

This commit is contained in:
Paul Chote
2010-11-24 10:26:38 +13:00
parent 00dc91cf49
commit f11bcd27cc
8 changed files with 31 additions and 33 deletions

View File

@@ -67,8 +67,8 @@ namespace OpenRA.Traits
var map = w.Map;
for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.TopLeft.X; x < map.BottomRight.X; x++)
for (int y = map.TopLeft.Y; y < map.BottomRight.Y; y++)
{
// Todo: Valid terrain should be specified in the resource
if (!AllowResourceAt(new int2(x,y)))
@@ -80,8 +80,8 @@ namespace OpenRA.Traits
content[x, y].image = ChooseContent(content[x, y].type);
}
for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.TopLeft.X; x < map.BottomRight.X; x++)
for (int y = map.TopLeft.Y; y < map.BottomRight.Y; y++)
if (content[x, y].type != null)
{
content[x, y].density = GetIdealDensity(x, y);

View File

@@ -48,10 +48,10 @@ namespace OpenRA.Traits
{
var min = a - new int2(r, r);
var max = a + new int2(r, r);
if (min.X < world.Map.XOffset - 1) min.X = world.Map.XOffset - 1;
if (min.Y < world.Map.YOffset - 1) min.Y = world.Map.YOffset - 1;
if (max.X > world.Map.XOffset + world.Map.Width) max.X = world.Map.XOffset + world.Map.Width;
if (max.Y > world.Map.YOffset + world.Map.Height) max.Y = world.Map.YOffset + world.Map.Height;
if (min.X < world.Map.TopLeft.X - 1) min.X = world.Map.TopLeft.X - 1;
if (min.Y < world.Map.TopLeft.Y - 1) min.Y = world.Map.TopLeft.Y - 1;
if (max.X > world.Map.BottomRight.X) max.X = world.Map.BottomRight.X;
if (max.Y > world.Map.BottomRight.Y) max.Y = world.Map.BottomRight.Y;
for (var j = min.Y; j <= max.Y; j++)
for (var i = min.X; i <= max.X; i++)

View File

@@ -49,10 +49,10 @@ namespace OpenRA.Traits
{
var bounds = a.Actor.GetBounds(true);
if (bounds.Right <= Game.CellSize * self.World.Map.XOffset) continue;
if (bounds.Bottom <= Game.CellSize * self.World.Map.YOffset) continue;
if (bounds.Left >= Game.CellSize * (self.World.Map.XOffset + self.World.Map.Width)) continue;
if (bounds.Top >= Game.CellSize * (self.World.Map.YOffset + self.World.Map.Height)) continue;
if (bounds.Right <= Game.CellSize * self.World.Map.TopLeft.X) continue;
if (bounds.Bottom <= Game.CellSize * self.World.Map.TopLeft.Y) continue;
if (bounds.Left >= Game.CellSize * self.World.Map.BottomRight.X) continue;
if (bounds.Top >= Game.CellSize * self.World.Map.BottomRight.Y) continue;
var i1 = Math.Max(0, (int)bounds.Left / scale);
var i2 = Math.Min(bins.GetUpperBound(0), (int)bounds.Right / scale);