#include <src/Ext/BuildingType/Body.h>
List of all members.
Member Typedef Documentation
Member Function Documentation
bool BuildingTypeExt::IsFoundationEqual |
( |
BuildingTypeClass * |
pTBldA, |
|
|
BuildingTypeClass * |
pTBldB |
|
) |
| [static] |
void BuildingTypeExt::UpdateSecretLabOptions |
( |
BuildingClass * |
pThis | ) |
[static] |
{
BuildingTypeClass *pType = pThis->Type;
BuildingTypeExt::ExtData* pData = BuildingTypeExt::ExtMap.Find(pType);
DEBUGLOG("Secret Lab update for %s\n", pType->get_ID());
if(!pData->Secret_Boons.Count || (pData->Secret_Placed && !pData->Secret_RecalcOnCapture)) {
return;
}
TechnoTypeClass *Result = pType->SecretInfantry;
if(!Result) {
Result = pType->SecretUnit;
if(!Result) {
Result = pType->SecretBuilding;
}
}
if(Result) {
pThis->SecretProduction = Result;
return;
}
HouseClass *Owner = pThis->Owner;
unsigned int OwnerBits = 1 << Owner->Type->ArrayIndex;
DynamicVectorClass<TechnoTypeClass *> Options;
for(int i = 0; i < pData->Secret_Boons.Count; ++i) {
TechnoTypeClass * Option = pData->Secret_Boons.GetItem(i);
TechnoTypeExt::ExtData* pTech = TechnoTypeExt::ExtMap.Find(Option);
if((pTech->Secret_RequiredHouses & OwnerBits) && !(pTech->Secret_ForbiddenHouses & OwnerBits)) {
bool ShouldAdd = false;
switch(HouseExt::RequirementsMet(Owner, Option)) {
case HouseExt::Forbidden:
case HouseExt::Incomplete:
ShouldAdd = true;
break;
}
if(ShouldAdd) {
Options.AddItem(Option);
}
}
}
if(Options.Count < 1) {
DEBUGLOG("Secret Lab [%s] has no boons applicable to country [%s]!\n",
pType->ID, Owner->Type->ID);
return;
}
int idx = ScenarioClass::Instance->Random.RandomRanged(0, Options.Count - 1);
Result = Options[idx];
DEBUGLOG("Secret Lab rolled %s for %s\n", Result->ID, pType->ID);
pData->Secret_Placed = true;
pThis->SecretProduction = Result;
}
Member Data Documentation
The documentation for this class was generated from the following files: