Move ChooseRandomCell from WorldUtils to Map
This commit is contained in:
@@ -19,6 +19,7 @@ using OpenRA.FileSystem;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Support;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -556,5 +557,12 @@ namespace OpenRA
|
||||
var r = Bounds;
|
||||
return xy.Clamp(new Rectangle(r.X, r.Y, r.Width - 1, r.Height - 1));
|
||||
}
|
||||
|
||||
public CPos ChooseRandomCell(MersenneTwister r)
|
||||
{
|
||||
return new CPos(
|
||||
r.Next(Bounds.Left, Bounds.Right),
|
||||
r.Next(Bounds.Top, Bounds.Bottom));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,13 +100,6 @@ namespace OpenRA
|
||||
: (edge ? w.Map.Bounds.Top : w.Map.Bounds.Bottom));
|
||||
}
|
||||
|
||||
public static CPos ChooseRandomCell(this World w, MersenneTwister r)
|
||||
{
|
||||
return new CPos(
|
||||
r.Next(w.Map.Bounds.Left, w.Map.Bounds.Right),
|
||||
r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom));
|
||||
}
|
||||
|
||||
public static WRange DistanceToMapEdge(this World w, WPos pos, WVec dir)
|
||||
{
|
||||
var tl = w.Map.Bounds.TopLeftAsCPos().TopLeft;
|
||||
|
||||
Reference in New Issue
Block a user