| 256 | } |
| 257 | |
| 258 | bool 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? |
| 287 | void BuildingExt::ExtData::ApplyPoweredKillSpawns() |