From efb54202ea16841491d13c42f4a056168e147fef Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 15 Jun 2025 10:58:12 +0300 Subject: [PATCH] Fix Mercprofile usStrategicInsertionData for bigmaps NPCs would not appear in the map if their gridno was over 65535 in large maps --- Ja2/GameVersion.h | 4 ++-- Ja2/SaveLoadGame.cpp | 11 ++++++++++- Tactical/soldier profile type.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Ja2/GameVersion.h b/Ja2/GameVersion.h index b516b225..f85ee016 100644 --- a/Ja2/GameVersion.h +++ b/Ja2/GameVersion.h @@ -22,7 +22,7 @@ extern CHAR16 zBuildInformation[256]; // // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file - +#define MERC_PROFILE_INSERTION_DATA 185 // Bigmap support for AddProfileToMap function #define GROWTH_MODIFIERS 184 #define REBELCOMMAND 183 #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us @@ -105,7 +105,7 @@ extern CHAR16 zBuildInformation[256]; #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system -#define SAVE_GAME_VERSION GROWTH_MODIFIERS +#define SAVE_GAME_VERSION MERC_PROFILE_INSERTION_DATA //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index a0dd2cb5..4208cb56 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1467,7 +1467,16 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->ubLastDateSpokenTo, sizeof(this->ubLastDateSpokenTo), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLastQuoteSaidWasSpecial, sizeof(this->bLastQuoteSaidWasSpecial), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSectorZ, sizeof(this->bSectorZ), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + + if ( guiCurrentSaveGameVersion >= MERC_PROFILE_INSERTION_DATA ) + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof( this->usStrategicInsertionData ), sizeof( UINT32 ), numBytesRead ); + } + else + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + } + numBytesRead = ReadFieldByField( hFile, &this->bFriendlyOrDirectDefaultResponseUsedRecently, sizeof(this->bFriendlyOrDirectDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bRecruitDefaultResponseUsedRecently, sizeof(this->bRecruitDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bThreatenDefaultResponseUsedRecently, sizeof(this->bThreatenDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 8d427a5b..222d5401 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -934,7 +934,7 @@ public: UINT8 ubLastDateSpokenTo; UINT8 bLastQuoteSaidWasSpecial; INT8 bSectorZ; - UINT16 usStrategicInsertionData; + UINT32 usStrategicInsertionData; INT8 bFriendlyOrDirectDefaultResponseUsedRecently; INT8 bRecruitDefaultResponseUsedRecently; INT8 bThreatenDefaultResponseUsedRecently;