MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / GetEnhancedPower

Method GetEnhancedPower

src/Ext/BuildingType/Body.cpp:44–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44int 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
64int BuildingTypeExt::GetUpgradesAmount(BuildingTypeClass* pBuilding, HouseClass* pHouse) // not including producing upgrades
65{

Callers

nothing calls this directly

Calls 2

ContainsMethod · 0.80
FindMethod · 0.45

Tested by

no test coverage detected