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.
This commit is contained in:
Squiggles211
2014-05-02 08:26:36 -05:00
parent 11c9bd7bc8
commit a495d9d552

View File

@@ -113,10 +113,7 @@ namespace OpenRA.Mods.RA
public void Update(Cache<string, List<Actor>> 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;