Skip to content
Snippets Groups Projects
Commit af77350e authored by David Bergström's avatar David Bergström
Browse files

Move conversion of TECHLAB types to C++

parent 34db4c7b
No related branches found
No related tags found
No related merge requests found
...@@ -26,12 +26,31 @@ void add_requirement(BuildDescription & description, json & requirement) ...@@ -26,12 +26,31 @@ void add_requirement(BuildDescription & description, json & requirement)
} }
else if (type == "unitCount") else if (type == "unitCount")
{ {
// Units that needs to be completed at the unit location -> Addons
if (requirement["state"] == "CompleteOnlyAtUnit") if (requirement["state"] == "CompleteOnlyAtUnit")
{ {
for (auto & unit : requirement["unit"]) for (auto & unit : requirement["unit"])
{ {
//std::cout << "Addon: " << sc2::UnitTypeToName(static_cast<sc2::UNIT_TYPEID>(unit)) << " (" << unit << ")" << std::endl; //std::cout << "Addon: " << sc2::UnitTypeToName(static_cast<sc2::UNIT_TYPEID>(unit)) << " (" << unit << ")" << std::endl;
description.addons_needed.push_back(static_cast<sc2::UNIT_TYPEID>(unit)); sc2::UNIT_TYPEID unit_typeid = static_cast<sc2::UNIT_TYPEID>(unit);
if (unit_typeid == sc2::UNIT_TYPEID::TERRAN_TECHLAB)
{
switch (description.producer_type)
{
case sc2::UNIT_TYPEID::TERRAN_BARRACKS:
unit_typeid = sc2::UNIT_TYPEID::TERRAN_BARRACKSTECHLAB;
break;
case sc2::UNIT_TYPEID::TERRAN_FACTORY:
unit_typeid = sc2::UNIT_TYPEID::TERRAN_FACTORYTECHLAB;
break;
case sc2::UNIT_TYPEID::TERRAN_STARPORT:
unit_typeid = sc2::UNIT_TYPEID::TERRAN_STARPORTTECHLAB;
break;
default:
std::cout << "Unknown producer type for TECHLAB addon: " << sc2::UnitTypeToName(unit_typeid) << std::endl;
}
}
description.addons_needed.push_back(unit_typeid);
} }
} }
else if (requirement["state"] == "CompleteOnly") else if (requirement["state"] == "CompleteOnly")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment