instrument FindUnitsInCircle for perf
This commit is contained in:
@@ -25,6 +25,7 @@ using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Support;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -92,6 +93,8 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
public static IEnumerable<Actor> FindUnitsInCircle(this World world, float2 a, float r)
|
||||
{
|
||||
using (new PerfSample("FindUnitsInCircle"))
|
||||
{
|
||||
var min = a - new float2(r, r);
|
||||
var max = a + new float2(r, r);
|
||||
@@ -104,6 +107,7 @@ namespace OpenRA
|
||||
|
||||
return inBox.Where(x => (x.CenterLocation - a).LengthSquared < r * r);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<int2> FindTilesInCircle(this World world, int2 a, int r)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user