Ticket 515 : add debug code to have a better diagnostic if this happens again

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11147 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-04-24 20:18:31 +00:00
parent 7e5f51b270
commit b3f6177306

View File

@ -195,12 +195,23 @@ bool TrackManager::loadTrack(const std::string& dirname)
void TrackManager::removeTrack(const std::string &ident)
{
Track *track = getTrack(ident);
if (track == NULL)
{
fprintf(stderr, "[TrackManager] ERROR: There is no track named '%s'!!\n", ident.c_str());
assert(false);
return;
}
if (track->isInternal()) return;
std::vector<Track*>::iterator it = std::find(m_tracks.begin(),
m_tracks.end(), track);
assert(it!=m_tracks.end());
if (it == m_tracks.end())
{
fprintf(stderr, "[TrackManager] INTERNAL ERROR: Cannot find track '%s' in map!!\n", ident.c_str());
assert(false);
return;
}
int index = it - m_tracks.begin();
// Remove the track from all groups it belongs to