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

Method StoreTiberium

src/Ext/Building/Body.cpp:68–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void BuildingExt::StoreTiberium(BuildingClass* pThis, float amount, int idxTiberiumType, int idxStorageTiberiumType)
69{
70 auto const pDepositableTiberium = TiberiumClass::Array.GetItem(idxStorageTiberiumType);
71 float depositableTiberiumAmount = 0.0f; // Number of 'bails' that will be stored.
72 auto const pTiberium = TiberiumClass::Array.GetItem(idxTiberiumType);
73
74 if (amount > 0.0)
75 {
76 if (auto pBuildingType = pThis->Type)
77 {
78 if (auto const pExt = BuildingTypeExt::ExtMap.Find(pBuildingType))
79 {
80 if (pExt->Refinery_UseStorage)
81 {
82 // Store Tiberium in structures
83 depositableTiberiumAmount = (amount * pTiberium->Value) / pDepositableTiberium->Value;
84 pThis->Owner->GiveTiberium(depositableTiberiumAmount, idxStorageTiberiumType);
85 }
86 }
87 }
88 }
89}
90
91void BuildingExt::ExtData::UpdatePrimaryFactoryAI()
92{

Callers

nothing calls this directly

Calls 1

FindMethod · 0.45

Tested by

no test coverage detected