Implement height-aware map.ChooseRandomCell().
This commit is contained in:
@@ -999,11 +999,16 @@ namespace OpenRA
|
|||||||
|
|
||||||
public CPos ChooseRandomCell(MersenneTwister rand)
|
public CPos ChooseRandomCell(MersenneTwister rand)
|
||||||
{
|
{
|
||||||
// TODO: Account for terrain height
|
MPos[] cells;
|
||||||
var x = rand.Next(Bounds.Left, Bounds.Right);
|
do
|
||||||
var y = rand.Next(Bounds.Top, Bounds.Bottom);
|
{
|
||||||
|
var u = rand.Next(Bounds.Left, Bounds.Right);
|
||||||
|
var v = rand.Next(Bounds.Top, Bounds.Bottom);
|
||||||
|
|
||||||
return new MPos(x, y).ToCPos(this);
|
cells = Unproject(new PPos(u, v));
|
||||||
|
} while (!cells.Any());
|
||||||
|
|
||||||
|
return cells.Random(rand).ToCPos(TileShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPos ChooseClosestEdgeCell(CPos pos)
|
public CPos ChooseClosestEdgeCell(CPos pos)
|
||||||
|
|||||||
Reference in New Issue
Block a user