// 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(); }
ActionID ActionTypeData::GetActionID(const BWAPI::UpgradeType & type) { const RaceID raceID = GetRaceID(type.getRace()); for (ActionID a(0); a < ActionTypeData::GetNumActionTypes(raceID); ++a) { const ActionTypeData & data = GetActionTypeData(raceID, a); if (data.isUpgrade() && data.getUpgradeType() == type) { return data.getActionID(); } } BOSS_ASSERT(false, "Could not find TechType: %d %s", type.getID(), type.getName().c_str()); return 0; }