From bbab5237d122a5d5bce026d6299aa3ab03c67863 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 13 Oct 2012 12:29:20 +1300 Subject: [PATCH] get rid of crazy wasted work in HackyAI --- OpenRA.Mods.RA/AI/HackyAI.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 2ffd88c7c2..2d741ecdca 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -165,13 +165,12 @@ namespace OpenRA.Mods.RA.AI { var bi = Rules.Info[actorType].Traits.Get(); - for (var k = 0; k < MaxBaseDistance; k++) - foreach (var t in world.FindTilesInCircle(baseCenter, k)) - if (world.CanPlaceBuilding(actorType, bi, t, null)) - if (bi.IsCloseEnoughToBase(world, p, actorType, t)) - if (NoBuildingsUnder(Util.ExpandFootprint( - FootprintUtils.Tiles(actorType, bi, t), false))) - return t; + foreach (var t in world.FindTilesInCircle(baseCenter, MaxBaseDistance)) + if (world.CanPlaceBuilding(actorType, bi, t, null)) + if (bi.IsCloseEnoughToBase(world, p, actorType, t)) + if (NoBuildingsUnder(Util.ExpandFootprint( + FootprintUtils.Tiles(actorType, bi, t), false))) + return t; return null; // i don't know where to put it. }