From 0d81546d1dd9ca740dc6f17c08e7c441206e9396 Mon Sep 17 00:00:00 2001 From: Stefan Brynielsson <stebr364@student.liu.se> Date: Thu, 21 Nov 2019 21:17:31 +0100 Subject: [PATCH] Implemented buildTime to TechTree, the build time is in seconds. The implementation has been tested --- src/TechTree.cpp | 2 +- src/TechTreeImproved.cpp | 2 +- src/TechTreeImproved.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TechTree.cpp b/src/TechTree.cpp index f9b5aba5d..eb94cc0fa 100644 --- a/src/TechTree.cpp +++ b/src/TechTree.cpp @@ -48,7 +48,7 @@ void TechTree::onStart() data.requiredUnits.clear(); data.requiredUpgrades.clear(); updated.insert(description.result_type); - data.buildTime = description.buildTime; + data.buildTime = description.buildTime; // The time in seconds it takes to create the unit data.buildAbility = sc2::ABILITY_ID::INVALID; } diff --git a/src/TechTreeImproved.cpp b/src/TechTreeImproved.cpp index a6594be4f..eab4ff200 100644 --- a/src/TechTreeImproved.cpp +++ b/src/TechTreeImproved.cpp @@ -116,7 +116,7 @@ void parse_build_description(BuildDescription & description, json & build_item) { description.result_type = static_cast<sc2::UNIT_TYPEID>(build_item["unit"]); description.build_ability = static_cast<sc2::ABILITY_ID>(build_item["ability"]); - description.buildTime = static_cast<int>(build_item["time"]); + description.buildTime = static_cast<int>(build_item["time"]); // The time in seconds it takes to create the unit parsed from the json file if (build_item.find("requires") != build_item.end()) { diff --git a/src/TechTreeImproved.h b/src/TechTreeImproved.h index 4dd5a253b..d5134a532 100644 --- a/src/TechTreeImproved.h +++ b/src/TechTreeImproved.h @@ -18,7 +18,7 @@ struct BuildDescription std::vector<sc2::UNIT_TYPEID> buildings_needed; std::vector<sc2::UNIT_TYPEID> addons_needed; std::vector<sc2::UPGRADE_ID> upgrades_needed; - int buildTime; + int buildTime; // The time in seconds it takes to create the unit }; struct ResearchDescription -- GitLab