// TechType action ActionTypeData::ActionTypeData(BWAPI::TechType t, const ActionID id) : type(TechType) , tech(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.researchTime()) , numberProduced(1) , name(t.getName()) , metaName(t.getName()) , building(false) , worker(false) , refinery(false) , resourceDepot(false) , supplyProvider(false) , canProduceBool(false) , canAttackBool(false) , whatBuildsUnitType(t.whatResearches()) , addon(false) , reqAddon(false) , reqAddonID(0) , morphed(false) { setShortName(); }
bool BuildOrderManager::hasResources(BWAPI::TechType t, int time) { pair<int, Resources> res; res.first=time; res.second.minerals=t.mineralPrice(); res.second.gas=t.gasPrice(); return hasResources(res); }
bool BuildOrderManager::hasResources(BWAPI::TechType t) { if (BWAPI::Broodwar->self()->cumulativeMinerals()-this->usedMinerals<t.mineralPrice()) return false; if (BWAPI::Broodwar->self()->cumulativeGas()-this->usedGas<t.gasPrice()) return false; return true; }
void BuildOrderManager::spendResources(BWAPI::TechType t) { this->usedMinerals+=t.mineralPrice(); this->usedGas+=t.gasPrice(); }
Resources::Resources(BWAPI::TechType type) { minerals = type.mineralPrice(); gas = type.gasPrice(); supply = 0.0; }