From 56a38b9463b6880a0d31cbdaf64d138f847d52fd Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 8 Jul 2011 22:25:48 +1200 Subject: [PATCH] [1/2] fixed #998 -- clean up HackyAI.BuildRandom --- OpenRA.Mods.RA/HackyAI.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 67a93359c1..8d15f326a3 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -437,23 +437,8 @@ namespace OpenRA.Mods.RA return; var unit = ChooseRandomUnitToBuild(queue); - Boolean found = false; - if (unit != null) - { - foreach (var un in Info.UnitsToBuild) - { - if (un.Key == unit.Name) - { - found = true; - break; - } - } - - if (found == true) - { - world.IssueOrder(Order.StartProduction(queue.self, unit.Name, 1)); - } - } + if (unit != null && Info.UnitsToBuild.Any( u => u.Key == unit.Name )) + world.IssueOrder(Order.StartProduction(queue.self, unit.Name, 1)); } class BaseBuilder