From 7ae802505c6bcda8fed110d5de739dfe151ead1f Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 21 Jul 2013 21:19:12 +0000 Subject: [PATCH] - Bugfix: After loading a game, mercs gearkits are bugged and game crashes when hiring a merc (by silversurfer) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6237 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 5547b077..444d2415 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -5959,19 +5959,19 @@ BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) if(guiCurrentSaveGameVersion < STOMP12_SAVEGAME_DATATYPE_CHANGE && cnt >= NUM_PROFILES_v111) break; // 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 ) - memcpy( &gMercProfiles[cnt], &tempMercProfile, sizeof(gMercProfiles[cnt]) ); -/* // Changed by ADB, rev 1513 + // let's store the current data in a placeholder + tempMercProfile = gMercProfiles[cnt]; + // now load the merc data from savegame + // Changed by ADB, rev 1513 //if ( !gMercProfiles[cnt].Load(hFile, false) ) if ( !gMercProfiles[cnt].Load(hFile, false, false, true) ) { return(FALSE); - }*/ + } + // now check if we loaded a valid merc profile + // if not then overwrite with the previously stored data + if ( gMercProfiles[cnt].bLifeMax <= 0 ) + gMercProfiles[cnt] = tempMercProfile; } return( TRUE );