Move ClampToWorld from WorldUtils to Map
This commit is contained in:
@@ -550,5 +550,11 @@ namespace OpenRA
|
||||
var tileSet = Rules.TileSets[Tileset];
|
||||
return tileSet[GetTerrainIndex(cell)];
|
||||
}
|
||||
|
||||
public CPos Clamp(CPos xy)
|
||||
{
|
||||
var r = Bounds;
|
||||
return xy.Clamp(new Rectangle(r.X, r.Y, r.Width - 1, r.Height - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,6 @@ namespace OpenRA
|
||||
public const int MaxRange = 50;
|
||||
static List<CVec>[] TilesByDistance = InitTilesByDistance(MaxRange);
|
||||
|
||||
public static CPos ClampToWorld(this World world, CPos xy)
|
||||
{
|
||||
var r = world.Map.Bounds;
|
||||
return xy.Clamp(new Rectangle(r.X,r.Y,r.Width-1, r.Height-1));
|
||||
}
|
||||
|
||||
public static CPos ChooseRandomEdgeCell(this World w)
|
||||
{
|
||||
var isX = w.SharedRandom.Next(2) == 0;
|
||||
|
||||
Reference in New Issue
Block a user