diff --git a/neo/sys/sys_savegame.cpp b/neo/sys/sys_savegame.cpp index 6812ed61..a7f8bc15 100644 --- a/neo/sys/sys_savegame.cpp +++ b/neo/sys/sys_savegame.cpp @@ -272,7 +272,6 @@ idSaveLoadParms::~idSaveLoadParms */ idSaveLoadParms::~idSaveLoadParms() { - /* SRS - Don't need to repeat this code here, since auto-deletes are already handled by idSaveGameManager::FinishProcessor for( int i = 0; i < files.Num(); ++i ) { if( files[i]->type & SAVEGAMEFILE_AUTO_DELETE ) @@ -280,7 +279,6 @@ idSaveLoadParms::~idSaveLoadParms() delete files[i]; } } - */ } /* diff --git a/neo/sys/sys_session_savegames.cpp b/neo/sys/sys_session_savegames.cpp index aefb1705..76867902 100644 --- a/neo/sys/sys_session_savegames.cpp +++ b/neo/sys/sys_session_savegames.cpp @@ -356,6 +356,7 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi { idSaveLoadParms& parms = processorLoadFiles->GetParmsNonConst(); saveGameHandle_t handle = 0; + bool checkDetailsFile = true; { // Put in a local block so everything will go in the global heap before the map change, but the heap is @@ -414,16 +415,28 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi parms.errorCode = SAVEGAME_E_UNKNOWN; } - if( parms.GetError() != SAVEGAME_E_NONE ) + // SRS - check details file for compatibility before removing it from parms.files list + if( parms.GetError() == SAVEGAME_E_NONE ) { - return 0; - } - - // Checks the description file to see if corrupted or if it's from a newer savegame - if( !LoadGameCheckDescriptionFile( parms ) ) - { - return 0; - } + // Checks the details file to see if corrupted or if it's from a newer savegame + checkDetailsFile = LoadGameCheckDescriptionFile( parms ); + } + + // tomgreen66 - remove details file we added via auto_ptr to parms.files in InitLoadFiles above + for ( int i = 0; i < parms.files.Num(); ++i ) + { + if ( parms.files[i] == gameDetailsFile.get() ) + { + // details file reference will be deleted by auto_ptr so remove it from list and update file count + parms.files.RemoveIndexFast( i ); + } + } + + // SRS - return if savegame error or description file corrupt or not compatible + if( parms.GetError() != SAVEGAME_E_NONE || !checkDetailsFile ) + { + return 0; + } // Checks to see if loaded map is from a DLC map and if that DLC is active if( !IsDLCAvailable( parms.description.GetMapName() ) )