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

Method DoGrindingExtras

src/Ext/Building/Body.cpp:258–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258bool BuildingExt::DoGrindingExtras(BuildingClass* pBuilding, TechnoClass* pTechno, int refund)
259{
260 if (auto const pExt = BuildingExt::ExtMap.Find(pBuilding))
261 {
262 auto const pTypeExt = pExt->TypeExtData;
263
264 pExt->AccumulatedIncome += refund;
265 pExt->GrindingWeapon_AccumulatedCredits += refund;
266
267 if (pTypeExt->Grinding_Weapon &&
268 Unsorted::CurrentFrame >= pExt->GrindingWeapon_LastFiredFrame + pTypeExt->Grinding_Weapon->ROF &&
269 pExt->GrindingWeapon_AccumulatedCredits >= pTypeExt->Grinding_Weapon_RequiredCredits)
270 {
271 TechnoExt::FireWeaponAtSelf(pBuilding, pTypeExt->Grinding_Weapon);
272 pExt->GrindingWeapon_LastFiredFrame = Unsorted::CurrentFrame;
273 pExt->GrindingWeapon_AccumulatedCredits = 0;
274 }
275
276 if (pTypeExt->Grinding_Sound >= 0)
277 {
278 VocClass::PlayAt(pTypeExt->Grinding_Sound, pTechno->GetCoords());
279 return true;
280 }
281 }
282
283 return false;
284}
285
286// Building only or allow units too?
287void BuildingExt::ExtData::ApplyPoweredKillSpawns()

Callers

nothing calls this directly

Calls 1

FindMethod · 0.45

Tested by

no test coverage detected