From 11c9bd7bc8102cfbe90af4ac8cab91b4095e5de0 Mon Sep 17 00:00:00 2001 From: Squiggles211 Date: Tue, 29 Apr 2014 01:07:56 -0500 Subject: [PATCH] Fix TechTree prerequisite bug for buildings with a build limit. Fixes where a building/unit whose prereq is a build limited structure was always available to be built even when the prereq was not satisfied. --- OpenRA.Mods.RA/Player/TechTree.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Player/TechTree.cs b/OpenRA.Mods.RA/Player/TechTree.cs index 4e85d0e8bc..1b37cce524 100755 --- a/OpenRA.Mods.RA/Player/TechTree.cs +++ b/OpenRA.Mods.RA/Player/TechTree.cs @@ -113,7 +113,11 @@ namespace OpenRA.Mods.RA public void Update(Cache> buildables) { - var hasReachedBuildLimit = buildLimit > 0 && buildables[Key].Count >= buildLimit; + var hasReachedBuildLimit = false; + + if(buildables.Keys.Contains(Key)) + hasReachedBuildLimit = buildLimit > 0 && buildables[Key].Count >= buildLimit; + var nowHasPrerequisites = HasPrerequisites(buildables) && !hasReachedBuildLimit; if (nowHasPrerequisites && !hasPrerequisites)