Introduce ScreenMap trait for caching screen-coord queries.

This commit is contained in:
Paul Chote
2013-09-21 13:39:39 +12:00
parent cad46e43c5
commit dfd51c0caa
24 changed files with 281 additions and 96 deletions

View File

@@ -106,7 +106,8 @@ namespace OpenRA.Mods.RA
yield break;
}
var underCursor = world.FindUnitsAtMouse(mi.Location)
var underCursor = world.ScreenMap.ActorsAt(Game.viewport.ViewToWorldPx(mi.Location))
.Where(a => !world.FogObscures(a))
.OrderByDescending(a => a.Info.Traits.Contains<SelectableInfo>()
? a.Info.Traits.Get<SelectableInfo>().Priority : int.MinValue)
.FirstOrDefault();