| 542 | } |
| 543 | |
| 544 | float HouseExt::ExtData::GetRestrictedFactoryPlantMult(TechnoTypeClass* pTechnoType) const |
| 545 | { |
| 546 | float mult = 1.0; |
| 547 | auto const pTechnoTypeExt = TechnoTypeExt::ExtMap.Find(pTechnoType); |
| 548 | |
| 549 | for (auto const pBuilding : this->RestrictedFactoryPlants) |
| 550 | { |
| 551 | auto const pTypeExt = BuildingTypeExt::ExtMap.Find(pBuilding->Type); |
| 552 | |
| 553 | if (pTypeExt->FactoryPlant_AllowTypes.size() > 0 && !pTypeExt->FactoryPlant_AllowTypes.Contains(pTechnoType)) |
| 554 | continue; |
| 555 | |
| 556 | if (pTypeExt->FactoryPlant_DisallowTypes.size() > 0 && pTypeExt->FactoryPlant_DisallowTypes.Contains(pTechnoType)) |
| 557 | continue; |
| 558 | |
| 559 | float currentMult = 1.0f; |
| 560 | |
| 561 | switch (pTechnoType->WhatAmI()) |
| 562 | { |
| 563 | case AbstractType::BuildingType: |
| 564 | if (((BuildingTypeClass*)pTechnoType)->BuildCat == BuildCat::Combat) |
| 565 | currentMult = pBuilding->Type->DefensesCostBonus; |
| 566 | else |
| 567 | currentMult = pBuilding->Type->BuildingsCostBonus; |
| 568 | break; |
| 569 | case AbstractType::AircraftType: |
| 570 | currentMult = pBuilding->Type->AircraftCostBonus; |
| 571 | break; |
| 572 | case AbstractType::InfantryType: |
| 573 | currentMult = pBuilding->Type->InfantryCostBonus; |
| 574 | break; |
| 575 | case AbstractType::UnitType: |
| 576 | currentMult = pBuilding->Type->UnitsCostBonus; |
| 577 | break; |
| 578 | default: |
| 579 | break; |
| 580 | } |
| 581 | |
| 582 | mult *= currentMult; |
| 583 | } |
| 584 | |
| 585 | return 1.0f - ((1.0f - mult) * pTechnoTypeExt->FactoryPlant_Multiplier); |
| 586 | } |
| 587 | |
| 588 | void HouseExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) |
| 589 | { |