From 98b42d2c489fb839b0cf5325a460736d9ce4e327 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Bergstr=C3=B6m?= <davbe125@student.liu.se>
Date: Tue, 31 Jul 2018 14:42:41 +0200
Subject: [PATCH] Only empty TechTree when there exists a BuildDescription

---
 src/TechTree.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/TechTree.cpp b/src/TechTree.cpp
index 62df02425..576ec8804 100644
--- a/src/TechTree.cpp
+++ b/src/TechTree.cpp
@@ -31,13 +31,18 @@ void TechTree::onStart()
     {
         TypeData & data = pair.second;
 
+        const std::vector<BuildDescription> & howToBuild = tree.HowToBuild(pair.first.getAPIUnitType());
+
+        if (howToBuild.empty())
+        {
+            continue;
+        }
+
         data.whatBuilds.clear();
         data.requiredUnits.clear();
         // TODO: Support for upgrades, is it possible via JSON? Is the hard coded information correct?
         data.requiredUpgrades.clear();
 
-        const std::vector<BuildDescription> & howToBuild = tree.HowToBuild(pair.first.getAPIUnitType());
-
         for (const BuildDescription & description : howToBuild)
         {
             data.whatBuilds.push_back(UnitType(description.producer_type, m_bot));
@@ -63,7 +68,6 @@ void TechTree::onStart()
         data.requiredUnits.clear();
         data.requiredUpgrades.clear();
 
-
         for (const ResearchDescription & description : tree.HowToResearch(id))
         {
             data.buildAbility = description.ability_used;
-- 
GitLab