Use Map.Bounds instead.
This commit is contained in:
@@ -213,10 +213,10 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
rd.width.Value = surface1.Map.MapSize.X;
|
rd.width.Value = surface1.Map.MapSize.X;
|
||||||
rd.height.Value = surface1.Map.MapSize.Y;
|
rd.height.Value = surface1.Map.MapSize.Y;
|
||||||
rd.cordonLeft.Value = surface1.Map.TopLeft.X;
|
rd.cordonLeft.Value = surface1.Map.Bounds.Left;
|
||||||
rd.cordonTop.Value = surface1.Map.TopLeft.Y;
|
rd.cordonTop.Value = surface1.Map.Bounds.Top;
|
||||||
rd.cordonRight.Value = surface1.Map.BottomRight.X;
|
rd.cordonRight.Value = surface1.Map.Bounds.Right;
|
||||||
rd.cordonBottom.Value = surface1.Map.BottomRight.Y;
|
rd.cordonBottom.Value = surface1.Map.Bounds.Bottom;
|
||||||
|
|
||||||
if (DialogResult.OK != rd.ShowDialog())
|
if (DialogResult.OK != rd.ShowDialog())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -505,8 +505,8 @@ namespace OpenRA.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.Graphics.DrawRectangle(CordonPen,
|
e.Graphics.DrawRectangle(CordonPen,
|
||||||
Map.TopLeft.X * TileSet.TileSize * Zoom + Offset.X,
|
Map.Bounds.Left * TileSet.TileSize * Zoom + Offset.X,
|
||||||
Map.TopLeft.Y * TileSet.TileSize * Zoom + Offset.Y,
|
Map.Bounds.Top * TileSet.TileSize * Zoom + Offset.Y,
|
||||||
Map.Width * TileSet.TileSize * Zoom,
|
Map.Width * TileSet.TileSize * Zoom,
|
||||||
Map.Height * TileSet.TileSize * Zoom);
|
Map.Height * TileSet.TileSize * Zoom);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ namespace OpenRA.FileFormats
|
|||||||
[FieldLoader.Load] public int2 BottomRight;
|
[FieldLoader.Load] public int2 BottomRight;
|
||||||
public int Width { get { return BottomRight.X - TopLeft.X; } }
|
public int Width { get { return BottomRight.X - TopLeft.X; } }
|
||||||
public int Height { get { return BottomRight.Y - TopLeft.Y; } }
|
public int Height { get { return BottomRight.Y - TopLeft.Y; } }
|
||||||
|
public Rectangle Bounds { get { return Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }
|
||||||
|
|
||||||
public MapStub() {} // Hack for the editor - not used for anything important
|
public MapStub() {} // Hack for the editor - not used for anything important
|
||||||
public MapStub(IFolder container)
|
public MapStub(IFolder container)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ namespace OpenRA.Graphics
|
|||||||
for (var x = 0; x < map.Width; x++)
|
for (var x = 0; x < map.Width; x++)
|
||||||
for (var y = 0; y < map.Height; y++)
|
for (var y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
var mapX = x + map.TopLeft.X;
|
var mapX = x + map.Bounds.Left;
|
||||||
var mapY = y + map.TopLeft.Y;
|
var mapY = y + map.Bounds.Top;
|
||||||
var type = tileset.GetTerrainType(map.MapTiles[mapX, mapY]);
|
var type = tileset.GetTerrainType(map.MapTiles[mapX, mapY]);
|
||||||
if (!tileset.Terrain.ContainsKey(type))
|
if (!tileset.Terrain.ContainsKey(type))
|
||||||
throw new InvalidDataException("Tileset {0} lacks terraintype {1}".F(tileset.Id, type));
|
throw new InvalidDataException("Tileset {0} lacks terraintype {1}".F(tileset.Id, type));
|
||||||
@@ -78,8 +78,8 @@ namespace OpenRA.Graphics
|
|||||||
for (var x = 0; x < map.Width; x++)
|
for (var x = 0; x < map.Width; x++)
|
||||||
for (var y = 0; y < map.Height; y++)
|
for (var y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
var mapX = x + map.TopLeft.X;
|
var mapX = x + map.Bounds.Left;
|
||||||
var mapY = y + map.TopLeft.Y;
|
var mapY = y + map.Bounds.Top;
|
||||||
if (map.MapResources[mapX, mapY].type == 0)
|
if (map.MapResources[mapX, mapY].type == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -112,8 +112,8 @@ namespace OpenRA.Graphics
|
|||||||
for (var x = 0; x < map.Width; x++)
|
for (var x = 0; x < map.Width; x++)
|
||||||
for (var y = 0; y < map.Height; y++)
|
for (var y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
var mapX = x + map.TopLeft.X;
|
var mapX = x + map.Bounds.Left;
|
||||||
var mapY = y + map.TopLeft.Y;
|
var mapY = y + map.Bounds.Top;
|
||||||
var custom = map.CustomTerrain[mapX,mapY];
|
var custom = map.CustomTerrain[mapX,mapY];
|
||||||
if (custom == null)
|
if (custom == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -146,7 +146,7 @@ namespace OpenRA.Graphics
|
|||||||
var color = t.Trait.RadarSignatureColor(t.Actor);
|
var color = t.Trait.RadarSignatureColor(t.Actor);
|
||||||
foreach (var cell in t.Trait.RadarSignatureCells(t.Actor))
|
foreach (var cell in t.Trait.RadarSignatureCells(t.Actor))
|
||||||
if (world.Map.IsInMap(cell))
|
if (world.Map.IsInMap(cell))
|
||||||
*(c + ((cell.Y - world.Map.TopLeft.Y) * bitmapData.Stride >> 2) + cell.X - world.Map.TopLeft.X) = color.ToArgb();
|
*(c + ((cell.Y - world.Map.Bounds.Top) * bitmapData.Stride >> 2) + cell.X - world.Map.Bounds.Left) = color.ToArgb();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,8 +174,8 @@ namespace OpenRA.Graphics
|
|||||||
for (var x = 0; x < map.Width; x++)
|
for (var x = 0; x < map.Width; x++)
|
||||||
for (var y = 0; y < map.Height; y++)
|
for (var y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
var mapX = x + map.TopLeft.X;
|
var mapX = x + map.Bounds.Left;
|
||||||
var mapY = y + map.TopLeft.Y;
|
var mapY = y + map.Bounds.Top;
|
||||||
if (!playerShroud.IsExplored(mapX, mapY))
|
if (!playerShroud.IsExplored(mapX, mapY))
|
||||||
*(c + (y * bitmapData.Stride >> 2) + x) = shroud;
|
*(c + (y * bitmapData.Stride >> 2) + x) = shroud;
|
||||||
else if (!playerShroud.IsVisible(mapX,mapY))
|
else if (!playerShroud.IsVisible(mapX,mapY))
|
||||||
|
|||||||
@@ -37,12 +37,13 @@ namespace OpenRA.Graphics
|
|||||||
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
||||||
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
||||||
|
|
||||||
terrainSheet = tileMapping[map.MapTiles[map.TopLeft.X, map.TopLeft.Y]].sheet;
|
terrainSheet = tileMapping[map.MapTiles[map.Bounds.Left, map.Bounds.Top]].sheet;
|
||||||
|
|
||||||
int nv = 0;
|
int nv = 0;
|
||||||
int ni = 0;
|
int ni = 0;
|
||||||
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
|
|
||||||
for( int i = map.TopLeft.X ; i < map.BottomRight.X; i++ )
|
for( int j = map.Bounds.Top; j < map.Bounds.Bottom; j++ )
|
||||||
|
for( int i = map.Bounds.Left; i < map.Bounds.Right; i++ )
|
||||||
{
|
{
|
||||||
Sprite tile = tileMapping[map.MapTiles[i, j]];
|
Sprite tile = tileMapping[map.MapTiles[i, j]];
|
||||||
// TODO: The zero below should explicitly refer to the terrain palette, but this code is called
|
// TODO: The zero below should explicitly refer to the terrain palette, but this code is called
|
||||||
@@ -69,7 +70,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
int visibleRows = (int)(viewport.Height * 1f / Game.CellSize + 2);
|
int visibleRows = (int)(viewport.Height * 1f / Game.CellSize + 2);
|
||||||
|
|
||||||
int firstRow = (int)(viewport.Location.Y * 1f / Game.CellSize - map.TopLeft.Y);
|
int firstRow = (int)(viewport.Location.Y * 1f / Game.CellSize - map.Bounds.Top);
|
||||||
int lastRow = firstRow + visibleRows;
|
int lastRow = firstRow + visibleRows;
|
||||||
|
|
||||||
if (lastRow < 0 || firstRow > map.Height)
|
if (lastRow < 0 || firstRow > map.Height)
|
||||||
@@ -81,11 +82,11 @@ namespace OpenRA.Graphics
|
|||||||
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.Disabled && world.LocalPlayer.Shroud.Bounds.HasValue)
|
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.Disabled && world.LocalPlayer.Shroud.Bounds.HasValue)
|
||||||
{
|
{
|
||||||
var r = world.LocalPlayer.Shroud.Bounds.Value;
|
var r = world.LocalPlayer.Shroud.Bounds.Value;
|
||||||
if (firstRow < r.Top - map.TopLeft.Y)
|
if (firstRow < r.Top - map.Bounds.Top)
|
||||||
firstRow = r.Top - map.TopLeft.Y;
|
firstRow = r.Top - map.Bounds.Top;
|
||||||
|
|
||||||
if (firstRow > r.Bottom - map.TopLeft.Y)
|
if (firstRow > r.Bottom - map.Bounds.Top)
|
||||||
firstRow = r.Bottom - map.TopLeft.Y;
|
firstRow = r.Bottom - map.Bounds.Top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lastRow < firstRow ) lastRow = firstRow;
|
if( lastRow < firstRow ) lastRow = firstRow;
|
||||||
|
|||||||
@@ -44,14 +44,10 @@ namespace OpenRA
|
|||||||
public byte TileFormat = 1;
|
public byte TileFormat = 1;
|
||||||
[FieldLoader.Load] public int2 MapSize;
|
[FieldLoader.Load] public int2 MapSize;
|
||||||
|
|
||||||
|
|
||||||
public TileReference<ushort, byte>[,] MapTiles;
|
public TileReference<ushort, byte>[,] MapTiles;
|
||||||
public TileReference<byte, byte>[,] MapResources;
|
public TileReference<byte, byte>[,] MapResources;
|
||||||
public string [,] CustomTerrain;
|
public string [,] CustomTerrain;
|
||||||
|
|
||||||
// Temporary compat hacks
|
|
||||||
public Rectangle Bounds { get { return Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }
|
|
||||||
|
|
||||||
public Map()
|
public Map()
|
||||||
{
|
{
|
||||||
// Do nothing; not a valid map (editor hack)
|
// Do nothing; not a valid map (editor hack)
|
||||||
@@ -221,8 +217,8 @@ namespace OpenRA
|
|||||||
x.Key,
|
x.Key,
|
||||||
x.Value.Save() ) ).ToList() ) );
|
x.Value.Save() ) ).ToList() ) );
|
||||||
|
|
||||||
root.Add( new MiniYamlNode( "Waypoints", MiniYaml.FromDictionary<string, int2>( Waypoints ) ) );
|
root.Add(new MiniYamlNode("Waypoints", MiniYaml.FromDictionary<string, int2>( Waypoints )));
|
||||||
root.Add( new MiniYamlNode( "Smudges", MiniYaml.FromList<SmudgeReference>( Smudges ) ) );
|
root.Add(new MiniYamlNode("Smudges", MiniYaml.FromList<SmudgeReference>( Smudges )));
|
||||||
root.Add(new MiniYamlNode("Rules", null, Rules));
|
root.Add(new MiniYamlNode("Rules", null, Rules));
|
||||||
root.Add(new MiniYamlNode("Sequences", null, Sequences));
|
root.Add(new MiniYamlNode("Sequences", null, Sequences));
|
||||||
root.Add(new MiniYamlNode("Weapons", null, Weapons));
|
root.Add(new MiniYamlNode("Weapons", null, Weapons));
|
||||||
@@ -334,7 +330,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public bool IsInMap(int x, int y)
|
public bool IsInMap(int x, int y)
|
||||||
{
|
{
|
||||||
return (x >= TopLeft.X && y >= TopLeft.Y && x < BottomRight.X && y < BottomRight.Y);
|
return Bounds.Contains(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static T[,] ResizeArray<T>(T[,] ts, T t, int width, int height)
|
static T[,] ResizeArray<T>(T[,] ts, T t, int width, int height)
|
||||||
|
|||||||
@@ -137,11 +137,12 @@ namespace OpenRA
|
|||||||
if (dirty)
|
if (dirty)
|
||||||
{
|
{
|
||||||
dirty = false;
|
dirty = false;
|
||||||
for (int i = map.TopLeft.X; i < map.BottomRight.X; i++)
|
for (int i = map.Bounds.Left; i < map.Bounds.Right; i++)
|
||||||
for (int j = map.TopLeft.Y; j < map.BottomRight.Y; j++)
|
for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
|
||||||
sprites[i, j] = ChooseShroud(i, j);
|
sprites[i, j] = ChooseShroud(i, j);
|
||||||
for (int i = map.TopLeft.X; i < map.BottomRight.X; i++)
|
|
||||||
for (int j = map.TopLeft.Y; j < map.BottomRight.Y; j++)
|
for (int i = map.Bounds.Left; i < map.Bounds.Right; i++)
|
||||||
|
for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
|
||||||
fogSprites[i, j] = ChooseFog(i, j);
|
fogSprites[i, j] = ChooseFog(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
var map = w.Map;
|
var map = w.Map;
|
||||||
|
|
||||||
for (int x = map.TopLeft.X; x < map.BottomRight.X; x++)
|
for (int x = map.Bounds.Left; x < map.Bounds.Right; x++)
|
||||||
for (int y = map.TopLeft.Y; y < map.BottomRight.Y; y++)
|
for (int y = map.Bounds.Top; y < map.Bounds.Bottom; y++)
|
||||||
{
|
{
|
||||||
// Todo: Valid terrain should be specified in the resource
|
// Todo: Valid terrain should be specified in the resource
|
||||||
if (!AllowResourceAt(new int2(x,y)))
|
if (!AllowResourceAt(new int2(x,y)))
|
||||||
@@ -80,8 +80,8 @@ namespace OpenRA.Traits
|
|||||||
content[x, y].image = ChooseContent(content[x, y].type);
|
content[x, y].image = ChooseContent(content[x, y].type);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = map.TopLeft.X; x < map.BottomRight.X; x++)
|
for (int x = map.Bounds.Left; x < map.Bounds.Right; x++)
|
||||||
for (int y = map.TopLeft.Y; y < map.BottomRight.Y; y++)
|
for (int y = map.Bounds.Top; y < map.Bounds.Bottom; y++)
|
||||||
if (content[x, y].type != null)
|
if (content[x, y].type != null)
|
||||||
{
|
{
|
||||||
content[x, y].density = GetIdealDensity(x, y);
|
content[x, y].density = GetIdealDensity(x, y);
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
var min = a - new int2(r, r);
|
var min = a - new int2(r, r);
|
||||||
var max = a + new int2(r, r);
|
var max = a + new int2(r, r);
|
||||||
if (min.X < world.Map.TopLeft.X - 1) min.X = world.Map.TopLeft.X - 1;
|
if (min.X < world.Map.Bounds.Left - 1) min.X = world.Map.Bounds.Left - 1;
|
||||||
if (min.Y < world.Map.TopLeft.Y - 1) min.Y = world.Map.TopLeft.Y - 1;
|
if (min.Y < world.Map.Bounds.Top - 1) min.Y = world.Map.Bounds.Top - 1;
|
||||||
if (max.X > world.Map.BottomRight.X) max.X = world.Map.BottomRight.X;
|
if (max.X > world.Map.Bounds.Right) max.X = world.Map.Bounds.Right;
|
||||||
if (max.Y > world.Map.BottomRight.Y) max.Y = world.Map.BottomRight.Y;
|
if (max.Y > world.Map.Bounds.Bottom) max.Y = world.Map.Bounds.Bottom;
|
||||||
|
|
||||||
for (var j = min.Y; j <= max.Y; j++)
|
for (var j = min.Y; j <= max.Y; j++)
|
||||||
for (var i = min.X; i <= max.X; i++)
|
for (var i = min.X; i <= max.X; i++)
|
||||||
@@ -165,10 +165,10 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public void ExploreAll(World world)
|
public void ExploreAll(World world)
|
||||||
{
|
{
|
||||||
for (int i = map.TopLeft.X; i < map.BottomRight.X; i++)
|
for (int i = map.Bounds.Left; i < map.Bounds.Right; i++)
|
||||||
for (int j = map.TopLeft.Y; j < map.BottomRight.Y; j++)
|
for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
|
||||||
exploredCells[i, j] = true;
|
exploredCells[i, j] = true;
|
||||||
exploredBounds = new Rectangle(world.Map.TopLeft.X,world.Map.TopLeft.Y,world.Map.Width,world.Map.Height);
|
exploredBounds = world.Map.Bounds;
|
||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
var bounds = a.Actor.GetBounds(true);
|
var bounds = a.Actor.GetBounds(true);
|
||||||
|
|
||||||
if (bounds.Right <= Game.CellSize * self.World.Map.TopLeft.X) continue;
|
if (bounds.Right <= Game.CellSize * self.World.Map.Bounds.Left) continue;
|
||||||
if (bounds.Bottom <= Game.CellSize * self.World.Map.TopLeft.Y) continue;
|
if (bounds.Bottom <= Game.CellSize * self.World.Map.Bounds.Top) continue;
|
||||||
if (bounds.Left >= Game.CellSize * self.World.Map.BottomRight.X) continue;
|
if (bounds.Left >= Game.CellSize * self.World.Map.Bounds.Right) continue;
|
||||||
if (bounds.Top >= Game.CellSize * self.World.Map.BottomRight.Y) continue;
|
if (bounds.Top >= Game.CellSize * self.World.Map.Bounds.Bottom) continue;
|
||||||
|
|
||||||
var i1 = Math.Max(0, (int)bounds.Left / scale);
|
var i1 = Math.Max(0, (int)bounds.Left / scale);
|
||||||
var i2 = Math.Min(bins.GetUpperBound(0), (int)bounds.Right / scale);
|
var i2 = Math.Min(bins.GetUpperBound(0), (int)bounds.Right / scale);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public int2 ConvertToPreview(MapStub map, int2 point)
|
public int2 ConvertToPreview(MapStub map, int2 point)
|
||||||
{
|
{
|
||||||
return new int2(MapRect.X + (int)(PreviewScale*(point.X - map.TopLeft.X)) , MapRect.Y + (int)(PreviewScale*(point.Y - map.TopLeft.Y)));
|
return new int2(MapRect.X + (int)(PreviewScale*(point.X - map.Bounds.Left)) , MapRect.Y + (int)(PreviewScale*(point.Y - map.Bounds.Top)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleInputInner(MouseInput mi)
|
public override bool HandleInputInner(MouseInput mi)
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var min = a - new int2(r, r);
|
var min = a - new int2(r, r);
|
||||||
var max = a + new int2(r, r);
|
var max = a + new int2(r, r);
|
||||||
if (min.X < world.Map.TopLeft.X) min.X = world.Map.TopLeft.X;
|
if (min.X < world.Map.Bounds.Left) min.X = world.Map.Bounds.Left;
|
||||||
if (min.Y < world.Map.TopLeft.Y) min.Y = world.Map.TopLeft.Y;
|
if (min.Y < world.Map.Bounds.Top) min.Y = world.Map.Bounds.Top;
|
||||||
if (max.X > world.Map.BottomRight.X - 1) max.X = world.Map.BottomRight.X - 1;
|
if (max.X > world.Map.Bounds.Right - 1) max.X = world.Map.Bounds.Right - 1;
|
||||||
if (max.Y > world.Map.BottomRight.Y - 1) max.Y = world.Map.BottomRight.Y - 1;
|
if (max.Y > world.Map.Bounds.Bottom - 1) max.Y = world.Map.Bounds.Bottom - 1;
|
||||||
|
|
||||||
for (var j = min.Y; j <= max.Y; j++)
|
for (var j = min.Y; j <= max.Y; j++)
|
||||||
for (var i = min.X; i <= max.X; i++)
|
for (var i = min.X; i <= max.X; i++)
|
||||||
@@ -103,17 +103,17 @@ namespace OpenRA
|
|||||||
var edge = w.SharedRandom.Next(2) == 0;
|
var edge = w.SharedRandom.Next(2) == 0;
|
||||||
|
|
||||||
return new int2(
|
return new int2(
|
||||||
isX ? w.SharedRandom.Next(w.Map.TopLeft.X, w.Map.BottomRight.X)
|
isX ? w.SharedRandom.Next(w.Map.Bounds.Left, w.Map.Bounds.Right)
|
||||||
: (edge ? w.Map.TopLeft.X : w.Map.BottomRight.X),
|
: (edge ? w.Map.Bounds.Left : w.Map.Bounds.Right),
|
||||||
!isX ? w.SharedRandom.Next(w.Map.TopLeft.Y, w.Map.BottomRight.Y)
|
!isX ? w.SharedRandom.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom)
|
||||||
: (edge ? w.Map.TopLeft.Y : w.Map.BottomRight.Y));
|
: (edge ? w.Map.Bounds.Top : w.Map.Bounds.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int2 ChooseRandomCell(this World w, Thirdparty.Random r)
|
public static int2 ChooseRandomCell(this World w, Thirdparty.Random r)
|
||||||
{
|
{
|
||||||
return new int2(
|
return new int2(
|
||||||
r.Next(w.Map.TopLeft.X, w.Map.BottomRight.X),
|
r.Next(w.Map.Bounds.Left, w.Map.Bounds.Right),
|
||||||
r.Next(w.Map.TopLeft.Y, w.Map.BottomRight.Y));
|
r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<CountryInfo> GetCountries(this World w)
|
public static IEnumerable<CountryInfo> GetCountries(this World w)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ namespace OpenRA.Mods.Cnc
|
|||||||
var owner = self.Owner;
|
var owner = self.Owner;
|
||||||
|
|
||||||
// Start and end beyond the edge of the map, to give a finite delay, and ability to land when AFLD is on map edge
|
// Start and end beyond the edge of the map, to give a finite delay, and ability to land when AFLD is on map edge
|
||||||
var startPos = new int2(owner.World.Map.BottomRight.X + 5, self.Location.Y);
|
var startPos = new int2(owner.World.Map.Bounds.Right + 5, self.Location.Y);
|
||||||
var endPos = new int2(owner.World.Map.TopLeft.X - 5, self.Location.Y);
|
var endPos = new int2(owner.World.Map.Bounds.Left - 5, self.Location.Y);
|
||||||
|
|
||||||
// Assume a single exit point for simplicity
|
// Assume a single exit point for simplicity
|
||||||
var exit = self.Info.Traits.WithInterface<ExitInfo>().First();
|
var exit = self.Info.Traits.WithInterface<ExitInfo>().First();
|
||||||
|
|||||||
@@ -225,12 +225,12 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
|
|
||||||
int2 CellToMinimapPixel(int2 p)
|
int2 CellToMinimapPixel(int2 p)
|
||||||
{
|
{
|
||||||
return new int2((int)(mapRect.X +previewScale*(p.X - world.Map.TopLeft.X)), (int)(mapRect.Y + previewScale*(p.Y - world.Map.TopLeft.Y)));
|
return new int2((int)(mapRect.X +previewScale*(p.X - world.Map.Bounds.Left)), (int)(mapRect.Y + previewScale*(p.Y - world.Map.Bounds.Top)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int2 MinimapPixelToCell(int2 p)
|
int2 MinimapPixelToCell(int2 p)
|
||||||
{
|
{
|
||||||
return new int2(world.Map.TopLeft.X + (int)((p.X - mapRect.X)/previewScale), world.Map.TopLeft.Y + (int)((p.Y - mapRect.Y)/previewScale));
|
return new int2(world.Map.Bounds.Left + (int)((p.X - mapRect.X)/previewScale), world.Map.Bounds.Top + (int)((p.Y - mapRect.Y)/previewScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user