Skip to content

Commit

Permalink
Fix IterBegin not being present
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Oct 12, 2020
1 parent 5a2e8ae commit 7442da7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Server/mods/deathmatch/logic/CTrainTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ CTrainTrack::~CTrainTrack()
{
// Remove all vehicles from the track
CVehicleManager* pVehicleManager = g_pGame->GetVehicleManager();
for (auto iter = pVehicleManager->IterBegin(); iter != pVehicleManager->IterEnd(); ++iter)
for (auto pVehicle : pVehicleManager->GetVehicles())
{
CVehicle* pVehicle = *iter;
if (pVehicle->GetTrainTrack() == this)
{
pVehicle->SetTrainTrack(nullptr);
pVehicle->SetDerailed(true);
}
if (pVehicle->GetTrainTrack() != this)
continue;

pVehicle->SetTrainTrack(nullptr);
pVehicle->SetDerailed(true);
}

// Unreference train track
Expand Down

0 comments on commit 7442da7

Please sign in to comment.