diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index 443db7f7..85272388 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -333,6 +333,7 @@ BOOLEAN AreAnyOfTheNewMercsAvailable(); void ShouldAnyNewMercMercBecomeAvailable(); BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck ); UINT32 CalcMercDaysServed(); +void RevaluateMercArray(); // silversurfer: for better savegame compatibility #ifdef JA2UB void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum ); BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum ); @@ -356,22 +357,43 @@ BOOLEAN SaveNewMercsToSaveGameFile( HWFILE hFile ) BOOLEAN LoadNewMercsFromLoadGameFile( HWFILE hFile ) { UINT32 uiNumBytesRead; + CONTITION_FOR_MERC_AVAILABLE ConditionsForMercAvailabilityLoad[ NUM_PROFILES ]; - FileRead( hFile, &gConditionsForMercAvailability, sizeof( gConditionsForMercAvailability ), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gConditionsForMercAvailability ) ) + FileRead( hFile, &ConditionsForMercAvailabilityLoad, sizeof( ConditionsForMercAvailabilityLoad ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( ConditionsForMercAvailabilityLoad ) ) { return( FALSE ); } - // make sure that gubMercArray (the list of mercs for M.E.R.C website) is populated with - // the same mercs as gConditionsForMercAvailability that we just read from the savegame + // silversurfer: Now update the true gConditionsForMercAvailability array with the data from the savegame. + // Take every index of gConditionsForMercAvailability array that we initialized in GameInitMercs() and see + // if we can find a matching profile ID in ConditionsForMercAvailabilityLoad array that we loaded from the savegame. + // This prevents some issues when old savegames are loaded with updated MercAvailability.xml. + for ( UINT8 i=0; i