// UpgradeType action ActionTypeData::ActionTypeData(BWAPI::UpgradeType t, const ActionID id) : type(UpgradeType) , upgrade(t) , actionID(id) , raceID(GetRaceID(t.getRace())) , mineralPriceVal(t.mineralPrice() * Constants::RESOURCE_SCALE) , gasPriceVal(t.gasPrice() * Constants::RESOURCE_SCALE) , supplyRequiredVal(0) , supplyProvidedVal(0) , buildTimeVal(t.upgradeTime()) , numberProduced(1) , name(t.getName()) , metaName(t.getName()) , building(false) , worker(false) , refinery(false) , resourceDepot(false) , supplyProvider(false) , canProduceBool(false) , canAttackBool(false) , whatBuildsUnitType(t.whatUpgrades()) , addon(false) , reqAddon(false) , reqAddonID(0) , morphed(false) { setShortName(); }
bool BuildOrderManager::hasResources(BWAPI::UpgradeType t, int time) { pair<int, Resources> res; res.first=time; res.second.minerals=t.mineralPrice(this->upgradeManager->getPlannedLevel(t)); res.second.gas=t.gasPrice(this->upgradeManager->getPlannedLevel(t)); return hasResources(res); }
void BuildOrderManager::spendResources(BWAPI::UpgradeType t) { this->usedMinerals+=t.mineralPrice(this->upgradeManager->getPlannedLevel(t)); this->usedGas+=t.gasPrice(this->upgradeManager->getPlannedLevel(t)); }
Resources::Resources(BWAPI::UpgradeType type, int level) { minerals = type.mineralPrice(level); gas = type.gasPrice(level); supply = 0.0; }