change iterator erasing so we don't need to overload the = operator

This commit is contained in:
Jonathan Gray 2013-04-25 16:20:17 +10:00
parent d7b7f5ac78
commit a064ebf87a
4 changed files with 7 additions and 52 deletions

View File

@ -2278,7 +2278,7 @@ int CSequencer::DestroySequence( CSequence *sequence )
{
if((*tsi).second == sequence)
{
tsi = m_taskSequences.erase(tsi);
m_taskSequences.erase(tsi++);
}
else
{

View File

@ -414,15 +414,7 @@ qboolean CROFFSystem::Unload( int id )
{ // requested item found in the list, free mem, then remove from list
delete ((CROFF *)(*itr).second);
#ifndef __linux__
itr = mROFFList.erase( itr );
#else
// darn stl differences
TROFFList::iterator titr;
titr = itr;
itr++;
mROFFList.erase(titr);
#endif
mROFFList.erase( itr++ );
#ifdef _DEBUG
Com_Printf( S_COLOR_GREEN"roff unloaded\n" );

View File

@ -1017,15 +1017,8 @@ void R_Images_DeleteLightMaps(void)
if (pImage->imgName[0] == '*' && strstr(pImage->imgName,"lightmap")) // loose check, but should be ok
{
R_Images_DeleteImageContents(pImage);
#ifndef __linux__
itImage = AllocatedImages.erase(itImage);
AllocatedImages.erase(itImage++);
bEraseOccured = qtrue;
#else
// MS & Dinkimware got the map::erase return wrong (it's null)
AllocatedImages_t::iterator itTemp = itImage;
itImage++;
AllocatedImages.erase(itTemp);
#endif
}
}
@ -1121,14 +1114,8 @@ qboolean RE_RegisterImages_LevelLoadEnd(void)
Com_DPrintf (S_COLOR_RED "Dumping image \"%s\"\n",pImage->imgName);
R_Images_DeleteImageContents(pImage);
#ifndef __linux__
itImage = AllocatedImages.erase(itImage);
AllocatedImages.erase(itImage++);
bEraseOccured = qtrue;
#else
AllocatedImages_t::iterator itTemp = itImage;
itImage++;
AllocatedImages.erase(itTemp);
#endif
}
}
}

View File

@ -386,18 +386,8 @@ qboolean RE_RegisterModels_LevelLoadEnd(qboolean bDeleteEverythingNotUsedThisLev
//CachedModel.pModelDiskImage = NULL; // REM for reference, erase() call below negates the need for it.
bAtLeastoneModelFreed = qtrue;
}
#ifndef __linux__
itModel = CachedModels->erase(itModel);
CachedModels->erase(itModel++);
bEraseOccured = qtrue;
#else
// Both MS and Dinkumware got the map::erase wrong
// The STL has the return type as a void
CachedModels_t::iterator itTemp;
itTemp = itModel;
itModel++;
CachedModels->erase(itTemp);
#endif
iLoadedModelBytes = GetModelDataAllocSize();
}
@ -446,18 +436,8 @@ static void RE_RegisterModels_DumpNonPure(void)
Z_Free(CachedModel.pModelDiskImage);
//CachedModel.pModelDiskImage = NULL; // REM for reference, erase() call below negates the need for it.
}
#ifndef __linux__
itModel = CachedModels->erase(itModel);
CachedModels->erase(itModel++);
bEraseOccured = qtrue;
#else
// Both MS and Dinkumware got the map::erase wrong
// The STL has the return type as a void
CachedModels_t::iterator itTemp;
itTemp = itModel;
itModel++;
CachedModels->erase(itTemp);
#endif
}
}
}
@ -500,7 +480,6 @@ static void RE_RegisterModels_DeleteAll(void)
return; //argh!
}
#ifndef __linux__
for (CachedModels_t::iterator itModel = CachedModels->begin(); itModel != CachedModels->end(); )
{
CachedEndianedModelBinary_t &CachedModel = (*itModel).second;
@ -509,11 +488,8 @@ static void RE_RegisterModels_DeleteAll(void)
Z_Free(CachedModel.pModelDiskImage);
}
itModel = CachedModels->erase(itModel);
CachedModels->erase(itModel++);
}
#else
CachedModels->erase(CachedModels->begin(),CachedModels->end());
#endif
}