Don't allow doubled tracks in random GP.

Otherwise track number limit wouldn't have sense.
This commit is contained in:
Deve 2014-11-04 20:27:01 +01:00
parent 66a1ff2b2b
commit 6d07189474

View File

@ -135,10 +135,24 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
continue;
bool is_already_added = false;
for (unsigned int i = 0; i < m_tracks.size(); i++)
{
if (m_tracks[i] == id)
{
is_already_added = true;
break;
}
}
if (!is_already_added)
{
m_tracks.push_back(id);
m_laps.push_back(track->getDefaultNumberOfLaps());
m_reversed.push_back(false); // This will be changed later in the code
}
m_tracks.push_back(id);
m_laps.push_back(track->getDefaultNumberOfLaps());
m_reversed.push_back(false); // This will be changed later in the code
track_indices.erase(track_indices.begin()+index);
}
}