| 325 | } |
| 326 | |
| 327 | void ScriptExt::WaitUntilFullAmmoAction(TeamClass* pTeam) |
| 328 | { |
| 329 | for (auto pUnit = pTeam->FirstUnit; pUnit; pUnit = pUnit->NextTeamMember) |
| 330 | { |
| 331 | if (!pUnit->InLimbo && pUnit->Health > 0) |
| 332 | { |
| 333 | auto const pUnitType = pUnit->GetTechnoType(); |
| 334 | |
| 335 | if (pUnitType->Ammo > 0 && pUnit->Ammo < pUnitType->Ammo) |
| 336 | { |
| 337 | // If an aircraft object have AirportBound it must be evaluated |
| 338 | if (auto const pAircraft = abstract_cast<AircraftClass*>(pUnit)) |
| 339 | { |
| 340 | if (pAircraft->Type->AirportBound) |
| 341 | { |
| 342 | // Reset last target, at long term battles this prevented the aircraft to pick a new target (rare vanilla YR bug) |
| 343 | pUnit->SetTarget(nullptr); |
| 344 | pUnit->LastTarget = nullptr; |
| 345 | // Fix YR bug (when returns from the last attack the aircraft switch in loop between Mission::Enter & Mission::Guard, making it impossible to land in the dock) |
| 346 | if (pUnit->IsInAir() && pUnit->CurrentMission != Mission::Enter) |
| 347 | pUnit->QueueMission(Mission::Enter, true); |
| 348 | |
| 349 | return; |
| 350 | } |
| 351 | } |
| 352 | else if (pUnitType->Reload != 0) // Don't skip units that can reload themselves |
| 353 | return; |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | pTeam->StepCompleted = true; |
| 359 | } |
| 360 | |
| 361 | void ScriptExt::Mission_Gather_NearTheLeader(TeamClass* pTeam, int countdown) |
| 362 | { |
nothing calls this directly
no test coverage detected