Move ChooseRandomEdgeCell from WorldUtils to Map
This commit is contained in:
@@ -558,11 +558,21 @@ namespace OpenRA
|
||||
return xy.Clamp(new Rectangle(r.X, r.Y, r.Width - 1, r.Height - 1));
|
||||
}
|
||||
|
||||
public CPos ChooseRandomCell(MersenneTwister r)
|
||||
public CPos ChooseRandomCell(MersenneTwister rand)
|
||||
{
|
||||
return new CPos(
|
||||
r.Next(Bounds.Left, Bounds.Right),
|
||||
r.Next(Bounds.Top, Bounds.Bottom));
|
||||
rand.Next(Bounds.Left, Bounds.Right),
|
||||
rand.Next(Bounds.Top, Bounds.Bottom));
|
||||
}
|
||||
|
||||
public CPos ChooseRandomEdgeCell(MersenneTwister rand)
|
||||
{
|
||||
var isX = rand.Next(2) == 0;
|
||||
var edge = rand.Next(2) == 0;
|
||||
|
||||
return new CPos(
|
||||
isX ? rand.Next(Bounds.Left, Bounds.Right) : (edge ? Bounds.Left : Bounds.Right),
|
||||
!isX ? rand.Next(Bounds.Top, Bounds.Bottom) : (edge ? Bounds.Top : Bounds.Bottom));
|
||||
}
|
||||
|
||||
public WRange DistanceToEdge(WPos pos, WVec dir)
|
||||
|
||||
@@ -55,18 +55,6 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
public static CPos ChooseRandomEdgeCell(this World w)
|
||||
{
|
||||
var isX = w.SharedRandom.Next(2) == 0;
|
||||
var edge = w.SharedRandom.Next(2) == 0;
|
||||
|
||||
return new CPos(
|
||||
isX ? w.SharedRandom.Next(w.Map.Bounds.Left, w.Map.Bounds.Right)
|
||||
: (edge ? w.Map.Bounds.Left : w.Map.Bounds.Right),
|
||||
!isX ? w.SharedRandom.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom)
|
||||
: (edge ? w.Map.Bounds.Top : w.Map.Bounds.Bottom));
|
||||
}
|
||||
|
||||
public static bool HasVoices(this Actor a)
|
||||
{
|
||||
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
|
||||
Reference in New Issue
Block a user