| 42 | } |
| 43 | |
| 44 | int BuildingTypeExt::GetEnhancedPower(BuildingClass* pBuilding, HouseClass* pHouse) |
| 45 | { |
| 46 | int nAmount = 0; |
| 47 | float fFactor = 1.0f; |
| 48 | |
| 49 | auto const pHouseExt = HouseExt::ExtMap.Find(pHouse); |
| 50 | |
| 51 | for (const auto& [bTypeIdx, nCount] : pHouseExt->PowerPlantEnhancers) |
| 52 | { |
| 53 | auto bTypeExt = BuildingTypeExt::ExtMap.Find(BuildingTypeClass::Array[bTypeIdx]); |
| 54 | if (bTypeExt->PowerPlantEnhancer_Buildings.Contains(pBuilding->Type)) |
| 55 | { |
| 56 | fFactor *= std::powf(bTypeExt->PowerPlantEnhancer_Factor, static_cast<float>(nCount)); |
| 57 | nAmount += bTypeExt->PowerPlantEnhancer_Amount * nCount; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return static_cast<int>(std::round(pBuilding->GetPowerOutput() * fFactor)) + nAmount; |
| 62 | } |
| 63 | |
| 64 | int BuildingTypeExt::GetUpgradesAmount(BuildingTypeClass* pBuilding, HouseClass* pHouse) // not including producing upgrades |
| 65 | { |