From 739d9a47d8d1d2904b13280c445e9ef9cf3e8a65 Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 7 Jul 2013 19:55:35 +0000 Subject: [PATCH] - Now it is possible to use the newly added DG M.E.R.C merc on an "older" savegame before those merc got integrated (by silversurfer) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6207 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 487f66c8e..939aeec5b 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -5951,18 +5951,27 @@ BOOLEAN SaveMercProfiles( HWFILE hFile ) BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) { UINT16 cnt; + MERCPROFILESTRUCT tempMercProfile; //Loop through all the profiles to Load for( cnt=0; cnt< NUM_PROFILES; cnt++) { // At some point after STOMP12_SAVEGAME_DATATYPE_CHANGE, NUM_PROFILES was changed from NUM_PROFILES_v111 if(guiCurrentSaveGameVersion < STOMP12_SAVEGAME_DATATYPE_CHANGE && cnt >= NUM_PROFILES_v111) break; - // Changed by ADB, rev 1513 + // silversurfer: What if mercs are added while we are mid game? + // let's load the savegame data into a placeholder + if ( !tempMercProfile.Load(hFile, false, false, true) ) + return(FALSE); + // and check if it contains valid merc data + // only then overwrite what we read from the MercProfiles.xml + if ( tempMercProfile.bLifeMax > 0 ) + gMercProfiles[cnt] = tempMercProfile; +/* // Changed by ADB, rev 1513 //if ( !gMercProfiles[cnt].Load(hFile, false) ) if ( !gMercProfiles[cnt].Load(hFile, false, false, true) ) { return(FALSE); - } + }*/ } return( TRUE );