From 7376ffbb685adf0a74b1d03f30452547c3b010d1 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Mon, 6 Jun 2011 22:28:19 +0000 Subject: [PATCH] BUGFIX 491 - Recast variables related to the Buddy/Hated system so that proper UINT8 values (0-255) are allowed. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4480 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/AimMembers.cpp | 2 +- SaveLoadGame.cpp | 8 ++++---- Strategic/Merc Contract.cpp | 2 +- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Profile.cpp | 6 +++--- Tactical/Soldier Profile.h | 8 ++++---- Tactical/XML_Profiles.cpp | 4 ++-- Tactical/soldier profile type.h | 12 ++++++------ 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 61b37400..d0b23f0d 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -3306,7 +3306,7 @@ UINT8 WillMercAcceptCall() BOOLEAN CanMercBeHired() { UINT8 i,j; - INT8 bMercID; + UINT8 bMercID; BOOLEAN fRetVal = FALSE; BOOLEAN fBuddyOnTeam=FALSE; diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 239b8e55..c5e1f003 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1203,7 +1203,7 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->bEvolution, sizeof(this->bEvolution), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags, sizeof(this->ubMiscFlags), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSexist, sizeof(this->bSexist), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bStealRate, sizeof(this->bStealRate), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bVocalVolume, sizeof(this->bVocalVolume), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubQuoteRecord, sizeof(this->ubQuoteRecord), sizeof(UINT8), numBytesRead); @@ -1281,8 +1281,8 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead += 28; } numBytesRead = ReadFieldByField( hFile, &this->bLeadership, sizeof(this->bLeadership), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, this->bBuddy, sizeof(this->bBuddy), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, this->bHated, sizeof(this->bHated), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField( hFile, this->bBuddy, sizeof(this->bBuddy), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField( hFile, this->bHated, sizeof(this->bHated), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bExpLevel, sizeof(this->bExpLevel), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bMarksmanship, sizeof(this->bMarksmanship), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bMinService, sizeof(this->bMinService), sizeof(UINT8), numBytesRead); @@ -1325,7 +1325,7 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for if(guiCurrentSaveGameVersion < STOMP12_SAVEGAME_DATATYPE_CHANGE) ReadFieldByField( hFile, &filler, sizeof(UINT8), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->sMedicalDepositAmount, sizeof(this->sMedicalDepositAmount), sizeof(UINT16), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->bLearnToLike, sizeof(this->bLearnToLike), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField( hFile, &this->bLearnToLike, sizeof(this->bLearnToLike), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, this->ubApproachVal, sizeof(this->ubApproachVal), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, this->ubApproachMod, sizeof(this->ubApproachMod), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bTown, sizeof(this->bTown), sizeof(INT8), numBytesRead); diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index b3dd1af7..b1a6230b 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -481,7 +481,7 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction ) BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) { UINT8 i; - INT8 bMercID; + UINT8 bMercID; BOOLEAN fBuddyAround = FALSE; BOOLEAN fUnhappy = FALSE; UINT16 usBuddyQuote=0; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 1f80675c..1146e796 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1229,8 +1229,8 @@ MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const OLD_MERCPROFILESTRUCT_101& memcpy( &(this->SKIN), &(src.SKIN), sizeof(PaletteRepID) ); // 30 memcpy( &(this->HAIR), &(src.HAIR), sizeof(PaletteRepID) ); // 30 - memcpy( &(this->bBuddy), &(src.bBuddy), 5 * sizeof (INT8)); - memcpy( &(this->bHated), &(src.bHated), 5 * sizeof (INT8)); + memcpy( &(this->bBuddy), &(src.bBuddy), 5 * sizeof (UINT8)); + memcpy( &(this->bHated), &(src.bHated), 5 * sizeof (UINT8)); memcpy( &(this->ubRoomRangeStart), &(src.ubRoomRangeStart), 2 * sizeof (UINT8)); memcpy( &(this->bMercTownReputation), &(src.bMercTownReputation), 20 * sizeof (INT8)); memcpy( &(this->usApproachFactor), &(src.usApproachFactor), 4 * sizeof (UINT16)); diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 54057a56..bcf1e1fe 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1939,7 +1939,7 @@ void UpdateSoldierPointerDataIntoProfile( BOOLEAN fPlayerMercs ) BOOLEAN DoesMercHaveABuddyOnTheTeam( UINT8 ubMercID ) { UINT8 ubCnt; - INT8 bBuddyID; + UINT8 bBuddyID; // loop through the list of people the merc is buddies with for(ubCnt=0; ubCnt< 3; ubCnt++) @@ -2344,11 +2344,11 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop ) } ////////////////////////////////////////////////////////////////////////////////////// - memcpy( &(gMercProfiles[ uiLoop ].bBuddy), &(tempProfiles[ uiLoop ].bBuddy), 5 * sizeof (INT8)); + memcpy( &(gMercProfiles[ uiLoop ].bBuddy), &(tempProfiles[ uiLoop ].bBuddy), 5 * sizeof (UINT8)); gMercProfiles[ uiLoop ].bLearnToLike = tempProfiles[ uiLoop ].bLearnToLike ; gMercProfiles[ uiLoop ].bLearnToLikeTime = tempProfiles[ uiLoop ].bLearnToLikeTime ; - memcpy( &(gMercProfiles[ uiLoop ].bHated), &(tempProfiles[ uiLoop ].bHated), 5 * sizeof (INT8)); + memcpy( &(gMercProfiles[ uiLoop ].bHated), &(tempProfiles[ uiLoop ].bHated), 5 * sizeof (UINT8)); memcpy( &(gMercProfiles[ uiLoop ].bHatedTime), &(tempProfiles[ uiLoop ].bHatedTime), 5 * sizeof (INT8)); gMercProfiles[ uiLoop ].bLearnToHate = tempProfiles[ uiLoop ].bLearnToHate ; gMercProfiles[ uiLoop ].bLearnToHateTime = tempProfiles[ uiLoop ].bLearnToHateTime ; diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 4f8fdad5..d114704b 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -347,13 +347,13 @@ typedef struct INT8 bNewSkillTrait29; INT8 bNewSkillTrait30; - INT8 bBuddy[5]; - INT8 bLearnToLike; + UINT8 bBuddy[5]; + UINT8 bLearnToLike; INT8 bLearnToLikeTime; - INT8 bHated[5]; + UINT8 bHated[5]; INT8 bHatedTime[5]; - INT8 bLearnToHate; + UINT8 bLearnToHate; INT8 bLearnToHateTime; INT16 sSalary; diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index e2a2f65b..ce63a502 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -308,11 +308,11 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bNewSkillTrait30 = pData->curProfile.bNewSkillTrait30; - memcpy( &(tempProfiles[pData->curIndex].bBuddy), &(pData->curProfile.bBuddy), 5 * sizeof (INT8)); + memcpy( &(tempProfiles[pData->curIndex].bBuddy), &(pData->curProfile.bBuddy), 5 * sizeof (UINT8)); tempProfiles[pData->curIndex].bLearnToLike = pData->curProfile.bLearnToLike; tempProfiles[pData->curIndex].bLearnToLikeTime = pData->curProfile.bLearnToLikeTime; - memcpy( &(tempProfiles[pData->curIndex].bHated), &(pData->curProfile.bHated), 5 * sizeof (INT8)); + memcpy( &(tempProfiles[pData->curIndex].bHated), &(pData->curProfile.bHated), 5 * sizeof (UINT8)); memcpy( &(tempProfiles[pData->curIndex].bHatedTime), &(pData->curProfile.bHatedTime), 5 * sizeof (INT8)); tempProfiles[pData->curIndex].bLearnToHate = pData->curProfile.bLearnToHate; tempProfiles[pData->curIndex].bLearnToHateTime = pData->curProfile.bLearnToHateTime; diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 6186f7f3..10f935bd 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -369,7 +369,7 @@ public: INT8 bEvolution; UINT8 ubMiscFlags; UINT8 bSexist; - INT8 bLearnToHate; + UINT8 bLearnToHate; // skills INT8 bStealRate; @@ -499,7 +499,7 @@ public: INT8 bBaseMorale; UINT16 sMedicalDepositAmount; - INT8 bLearnToLike; + UINT8 bLearnToLike; UINT8 ubApproachVal[4]; UINT8 ubApproachMod[3][4]; INT8 bTown; @@ -612,7 +612,7 @@ public: INT8 bEvolution; UINT8 ubMiscFlags; UINT8 bSexist; - INT8 bLearnToHate; + UINT8 bLearnToHate; // skills INT8 bStealRate; @@ -693,8 +693,8 @@ public: //INT8 bSkillTrait3; // added by SANDRO INT8 bLeadership; - INT8 bBuddy[5]; - INT8 bHated[5]; + UINT8 bBuddy[5]; + UINT8 bHated[5]; INT8 bExpLevel; // general experience level INT8 bMarksmanship; @@ -744,7 +744,7 @@ public: INT8 bBaseMorale; UINT16 sMedicalDepositAmount; - INT8 bLearnToLike; + UINT8 bLearnToLike; UINT8 ubApproachVal[4]; UINT8 ubApproachMod[3][4]; INT8 bTown;