Merge pull request #9635 from RoosterDragon/occupy-space-perf

Speed up checks for IOccupySpace trait
This commit is contained in:
atlimit8
2015-10-22 18:28:57 -05:00
5 changed files with 13 additions and 18 deletions

View File

@@ -574,7 +574,7 @@ namespace OpenRA.Mods.Common.AI
// Pick something worth attacking owned by that player
var target = World.Actors
.Where(a => a.Owner == enemy && a.Info.HasTraitInfo<IOccupySpaceInfo>())
.Where(a => a.Owner == enemy && a.OccupiesSpace != null)
.ClosestTo(World.Map.CenterOfCell(GetRandomBaseCenter()));
if (target == null)