@ -196,26 +196,36 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
writer . addMaster ( * iter , 0 ) ; // not using the size information anyway -> use value of 0
writer . setFormat ( ESM : : Header : : CurrentFormat ) ;
writer . setRecordCount (
1 // saved game header
+ MWBase : : Environment : : get ( ) . getJournal ( ) - > countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getWorld ( ) - > countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getDialogueManager ( ) - > countSavedGameRecords ( )
+ 1 // global map
) ;
int recordCount = 1 // saved game header
+ MWBase : : Environment : : get ( ) . getJournal ( ) - > countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getWorld ( ) - > countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . countSavedGameRecords ( )
+ MWBase : : Environment : : get ( ) . getDialogueManager ( ) - > countSavedGameRecords ( )
+ 1 ; // global map
writer . setRecordCount ( recordCount ) ;
writer . save ( stream ) ;
Loading : : Listener & listener = * MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getLoadingScreen ( ) ;
listener . setProgressRange ( recordCount ) ;
listener . setLabel ( " #{sNotifyMessage4} " ) ;
Loading : : ScopedLoad load ( & listener ) ;
writer . startRecord ( ESM : : REC_SAVE ) ;
slot - > mProfile . save ( writer ) ;
writer . endRecord ( ESM : : REC_SAVE ) ;
listener . increaseProgress ( ) ;
MWBase : : Environment : : get ( ) . getJournal ( ) - > write ( writer , listener ) ;
MWBase : : Environment : : get ( ) . getDialogueManager ( ) - > write ( writer , listener ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > write ( writer , listener ) ;
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . write ( writer , listener ) ;
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > write ( writer , listener ) ;
MWBase : : Environment : : get ( ) . getJournal ( ) - > write ( writer ) ;
MWBase : : Environment : : get ( ) . getDialogueManager ( ) - > write ( writer ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > write ( writer ) ;
MWBase : : Environment : : get ( ) . getScriptManager ( ) - > getGlobalScripts ( ) . write ( writer ) ;
MWBase : : Environment : : get ( ) . getWindowManager ( ) - > write ( writer ) ;
// Ensure we have written the number of records that was estimated
if ( writer . getRecordCount ( ) ! = recordCount + 1 ) // 1 extra for TES3 record
std : : cerr < < " Warning: number of written savegame records does not match. Estimated: " < < recordCount + 1 < < " , written: " < < writer . getRecordCount ( ) < < std : : endl ;
writer . close ( ) ;
@ -261,6 +271,13 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
std : : map < int , int > contentFileMap = buildContentFileIndexMap ( reader ) ;
Loading : : Listener & listener = * MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getLoadingScreen ( ) ;
listener . setProgressRange ( reader . getRecordCount ( ) ) ;
listener . setLabel ( " #{sLoadingMessage14} " ) ;
Loading : : ScopedLoad load ( & listener ) ;
while ( reader . hasMoreRecs ( ) )
{
ESM : : NAME n = reader . getRecName ( ) ;
@ -318,6 +335,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
/// \todo log error
reader . skipRecord ( ) ;
}
listener . increaseProgress ( ) ;
}
mCharacterManager . setCurrentCharacter ( character ) ;