Don't allow doubled tracks in random GP.
Otherwise track number limit wouldn't have sense.
This commit is contained in:
parent
66a1ff2b2b
commit
6d07189474
@ -135,10 +135,24 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
|||||||
|
|
||||||
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
||||||
continue;
|
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);
|
track_indices.erase(track_indices.begin()+index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user