From d83ae2a4c8447ea28bbb4142a7c6dc62b0af2fe9 Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 11 Mar 2014 21:26:11 +0000 Subject: [PATCH] Merged revision(s) 7049 from branches/ja2_source_official_2014: Fix: problems with loading IMP profiles between different game versions (checked on IMP from 6670, 6901, 7047) (by anv) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7050 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/IMP Confirm.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index a9e2b944..6a3fe204 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -39,6 +39,8 @@ #include "Soldier Profile.h" +#include "SaveLoadGame.h" + // Changed by ADB (rev 1513) to resolve IMPs created prior to structural changes //#define IMP_FILENAME_SUFFIX ".dat" #define OLD_IMP_FILENAME_SUFFIX ".dat" @@ -1529,15 +1531,21 @@ BOOLEAN LoadImpCharacter( STR nickName ) // read in the profile //if ( !gMercProfiles[ iProfileId ].Load(hFile, false) ) + + // anv: before loading profile we need to set guiCurrentSaveGameVersion to profile's version + // and set it back to SAVE_GAME_VERSION right after or else new saves will be broken! + guiCurrentSaveGameVersion = version; + if ( !gMercProfiles[ iProfileId ].Load(hFile, isOldVersion, false, false) ) { + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return FALSE; } + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; // close file FileClose(hFile); - //CHRISL: At this point, we need to resort profile inventory so that NewInv items don't accidentally appear in OldInv DistributeInitialGear(&gMercProfiles[iProfileId]);