void BuildOrderManager::spendResources(BWAPI::UpgradeType t) { this->usedMinerals+=t.mineralPriceBase()+t.mineralPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1); this->usedGas+=t.gasPriceBase()+t.gasPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1); }
bool BuildOrderManager::hasResources(BWAPI::UpgradeType t) { if (BWAPI::Broodwar->self()->cumulativeMinerals()-this->usedMinerals< t.mineralPriceBase()+t.mineralPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1)) return false; if (BWAPI::Broodwar->self()->cumulativeGas()-this->usedGas<t.gasPriceBase()+t.gasPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1)) return false; return true; }