spatial bin index for actors

This commit is contained in:
Chris Forbes
2010-03-22 18:43:52 +13:00
parent 2ed7cc5cc2
commit e2ba79a539
4 changed files with 83 additions and 6 deletions

View File

@@ -51,15 +51,16 @@ namespace OpenRA.Orders
return ChooseCursor(world, mi);
}
string ChooseCursor( World world, MouseInput mi )
string ChooseCursor(World world, MouseInput mi)
{
var p = Game.controller.MousePosition;
var c = Order(world, p.ToInt2(), mi)
.Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation))
.FirstOrDefault(a => a != null);
using (new PerfSample("cursor"))
{
var p = Game.controller.MousePosition;
var c = Order(world, p.ToInt2(), mi)
.Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation))
.FirstOrDefault(a => a != null);
return c ??
(world.SelectActorsInBox(Game.CellSize * p,
Game.CellSize * p).Any()