From a495d9d552e4a68f366a4950d76609bcb9edf8c5 Mon Sep 17 00:00:00 2001 From: Squiggles211 Date: Fri, 2 May 2014 08:26:36 -0500 Subject: [PATCH] Rewrite for better efficiency uses a single, more concise statement rather than an if statement, and checks buildLimit before attempting to check if the buildables cache contains the key. --- OpenRA.Mods.RA/Player/TechTree.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Player/TechTree.cs b/OpenRA.Mods.RA/Player/TechTree.cs index 1b37cce524..a320713820 100755 --- a/OpenRA.Mods.RA/Player/TechTree.cs +++ b/OpenRA.Mods.RA/Player/TechTree.cs @@ -113,10 +113,7 @@ namespace OpenRA.Mods.RA public void Update(Cache> buildables) { - var hasReachedBuildLimit = false; - - if(buildables.Keys.Contains(Key)) - hasReachedBuildLimit = buildLimit > 0 && buildables[Key].Count >= buildLimit; + var hasReachedBuildLimit = buildLimit > 0 && buildables.Keys.Contains(Key) && buildables[Key].Count >= buildLimit; var nowHasPrerequisites = HasPrerequisites(buildables) && !hasReachedBuildLimit;