MCPcopy Create free account
hub / github.com/bwapi/bwapi / hasUnitTypeRequirement

Method hasUnitTypeRequirement

bwapi/BWAPILIB/Source/Player.cpp:147–163  ·  view source on GitHub ↗

-------------------------------------- UNIT TYPE REQUIREMENT ---------------------------------------------

Source from the content-addressed store, hash-verified

145}
146//-------------------------------------- UNIT TYPE REQUIREMENT ---------------------------------------------
147bool PlayerInterface::hasUnitTypeRequirement(UnitType unit, int amount) const
148{
149 if (unit == UnitTypes::None)
150 return true;
151
152 switch (unit)
153 {
154 case UnitTypes::Enum::Zerg_Hatchery:
155 return completedUnitCount(UnitTypes::Zerg_Hatchery) + allUnitCount(UnitTypes::Zerg_Lair) + allUnitCount(UnitTypes::Zerg_Hive) >= amount;
156 case UnitTypes::Enum::Zerg_Lair:
157 return completedUnitCount(UnitTypes::Zerg_Lair) + allUnitCount(UnitTypes::Zerg_Hive) >= amount;
158 case UnitTypes::Enum::Zerg_Spire:
159 return completedUnitCount(UnitTypes::Zerg_Spire) + allUnitCount(UnitTypes::Zerg_Greater_Spire) >= amount;
160 default:
161 return completedUnitCount(unit) >= amount;
162 }
163}

Callers 3

canMakeFunction · 0.80
canResearchFunction · 0.80
canUpgradeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected