From 94a5972a8591061f165e65e0dcb126f3856f58d2 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:38:00 +0200 Subject: [PATCH] Perform explicit casts from UINT8 to UINT16 for SoldierID --- Strategic/Scheduling.cpp | 2 +- Tactical/Interface Items.h | 2 +- Tactical/Item Types.cpp | 4 ++-- Tactical/Soldier Control.cpp | 26 +++++++++++++------------- TileEngine/physics.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index f9dad5da..cd9c43d8 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -483,7 +483,7 @@ SCHEDULENODE& SCHEDULENODE::operator=(const _OLD_SCHEDULENODE& src) TranslateArrayFields(usData2, src.usData2, OLD_MAX_SCHEDULE_ACTIONS, INT16_INT32); TranslateArrayFields(ubAction, src.ubAction, OLD_MAX_SCHEDULE_ACTIONS, UINT8_UINT8); ubScheduleID = src.ubScheduleID; - ubSoldierID = src.ubSoldierID; + ubSoldierID = static_cast( src.ubSoldierID ); usFlags = src.usFlags; } return(*this); diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index 05192f76..a221e803 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -159,7 +159,7 @@ public: this->fCursorActive = src.fCursorActive; this->ItemPointerInfo = src.ItemPointerInfo; this->ubInvSlot = src.ubInvSlot; - this->ubSoldierID = src.ubSoldierID; + this->ubSoldierID = static_cast(src.ubSoldierID); return *this; } //could use a little tidying up diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 85e2af84..db19977b 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1566,7 +1566,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType; (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem; (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency - (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner; + (*this)[0]->data.misc.ubBombOwner = static_cast(src.ugYucky.ubBombOwner); (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue; (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID (*this)[0]->data.ubDirection = DIRECTION_IRRELEVANT; @@ -1658,7 +1658,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType; (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem; (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency - (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner; + (*this)[0]->data.misc.ubBombOwner = static_cast(src.ugYucky.ubBombOwner); (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue; (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID (*this)[0]->data.ubWireNetworkFlag = TRIPWIRE_NETWORK_OWNER_ENEMY; // it is always assumed that preplated traps are of hostile origin diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 673fbdbf..136973d9 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -632,7 +632,7 @@ void STRUCT_AIData::ConvertFrom_101_To_102( const OLDSOLDIERTYPE_101& src ) this->bMoved = src.bMoved; this->bHunting = src.bHunting; this->ubLastCall = src.ubLastCall; - this->ubCaller = src.ubCaller; + this->ubCaller = static_cast( src.ubCaller ); this->sCallerGridNo = src.sCallerGridNo; this->bCallPriority = src.bCallPriority; this->bCallActedUpon = src.bCallActedUpon; @@ -694,7 +694,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->sLastTwoLocations[0] = src.sLastTwoLocations[0]; this->sLastTwoLocations[1] = src.sLastTwoLocations[1]; - this->ubID = src.ubID; + this->ubID = static_cast( src.ubID ); //this->bReserved1 = src.bReserved1; this->ubBodyType = src.ubBodyType; @@ -717,7 +717,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->ubWaitActionToDo = src.ubWaitActionToDo; this->ubInsertionDirection = src.ubInsertionDirection; this->bGunType = src.bGunType; - this->ubOppNum = src.ubOppNum; + this->ubOppNum = static_cast( src.ubOppNum ); this->bLastRenderVisibleValue = src.bLastRenderVisibleValue; this->ubAttackingHand = src.ubAttackingHand; this->sWeightCarriedAtTurnStart = src.sWeightCarriedAtTurnStart; @@ -756,8 +756,8 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->uiAIDelay = src.uiAIDelay; this->sReloadDelay = src.sReloadDelay; - this->ubAttackerID = src.ubAttackerID; - this->ubPreviousAttackerID = src.ubPreviousAttackerID; + this->ubAttackerID = static_cast( src.ubAttackerID ); + this->ubPreviousAttackerID = static_cast( src.ubPreviousAttackerID ); this->sInsertionGridNo = src.sInsertionGridNo; @@ -808,7 +808,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->pCurrentShade = src.pCurrentShade; this->ubFadeLevel = src.ubFadeLevel; this->ubServiceCount = src.ubServiceCount; - this->ubServicePartner = src.ubServicePartner; + this->ubServicePartner = static_cast( src.ubServicePartner ); this->pThrowParams = src.pThrowParams; this->bReverse = src.bReverse; this->pLevelNode = src.pLevelNode; @@ -931,7 +931,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->ubSoldierClass = src.ubSoldierClass; //admin, elite, troop (creature types?) this->ubAPsLostToSuppression = src.ubAPsLostToSuppression; - this->ubSuppressorID = src.ubSuppressorID; + this->ubSuppressorID = static_cast( src.ubSuppressorID ); this->ubDesiredSquadAssignment = src.ubDesiredSquadAssignment; this->ubNumTraversalsAllowedToMerge = src.ubNumTraversalsAllowedToMerge; @@ -946,7 +946,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->bBlockedByAnotherMercDirection = src.bBlockedByAnotherMercDirection; this->usAttackingWeapon = src.usAttackingWeapon; this->bWeaponMode = src.bWeaponMode; - this->ubTargetID = src.ubTargetID; + this->ubTargetID = static_cast( src.ubTargetID ); this->bAIScheduleProgress = src.bAIScheduleProgress; this->sOffWorldGridNo = src.sOffWorldGridNo; this->pAniTile = src.pAniTile; @@ -966,8 +966,8 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->bOldBattleSnd = src.bOldBattleSnd; this->iBurstSoundID = src.iBurstSoundID; this->bSlotItemTakenFrom = src.bSlotItemTakenFrom; - this->ubAutoBandagingMedic = src.ubAutoBandagingMedic; - this->ubRobotRemoteHolderID = src.ubRobotRemoteHolderID; + this->ubAutoBandagingMedic = static_cast( src.ubAutoBandagingMedic ); + this->ubRobotRemoteHolderID = static_cast( src.ubRobotRemoteHolderID ); this->uiTimeOfLastContractUpdate = src.uiTimeOfLastContractUpdate; this->bTypeOfLastContract = src.bTypeOfLastContract; this->bTurnsCollapsed = src.bTurnsCollapsed; @@ -1003,7 +1003,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->usValueGoneUp = src.usValueGoneUp; this->ubNumLocateCycles = src.ubNumLocateCycles; this->ubDelayedMovementFlags = src.ubDelayedMovementFlags; - this->ubCTGTTargetID = src.ubCTGTTargetID; + this->ubCTGTTargetID = static_cast( src.ubCTGTTargetID ); this->uiMercChecksum = src.uiMercChecksum; @@ -1027,7 +1027,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->pGroup = src.pGroup; this->ubLeaveHistoryCode = src.ubLeaveHistoryCode; - this->bOverrideMoveSpeed = src.bOverrideMoveSpeed; + this->bOverrideMoveSpeed = static_cast( src.bOverrideMoveSpeed ); this->uiTimeSoldierWillArrive = src.uiTimeSoldierWillArrive; this->bVehicleUnderRepairID = src.bVehicleUnderRepairID; @@ -1040,7 +1040,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->iTuringSoundID = src.iTuringSoundID; this->ubLastDamageReason = src.ubLastDamageReason; this->uiTimeSinceLastBleedGrunt = src.uiTimeSinceLastBleedGrunt; - this->ubNextToPreviousAttackerID = src.ubNextToPreviousAttackerID; + this->ubNextToPreviousAttackerID = static_cast( src.ubNextToPreviousAttackerID ); this->bDoAutofire = src.bDoAutofire; this->numFlanks = src.numFlanks; this->lastFlankSpot = src.lastFlankSpot; diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index eb2179a8..f05398c2 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -160,7 +160,7 @@ REAL_OBJECT& REAL_OBJECT::operator =(OLD_REAL_OBJECT_101 &src) this->dLifeSpan = src.dLifeSpan; this->fFirstTimeMoved = src.fFirstTimeMoved; this->sFirstGridNo = src.sFirstGridNo; - this->ubOwner = src.ubOwner; + this->ubOwner = static_cast(src.ubOwner); this->ubActionCode = src.ubActionCode; this->uiActionData = src.uiActionData; this->fDropItem = src.fDropItem; @@ -175,7 +175,7 @@ REAL_OBJECT& REAL_OBJECT::operator =(OLD_REAL_OBJECT_101 &src) this->fPotentialForDebug = src.fPotentialForDebug; this->sLevelNodeGridNo = src.sLevelNodeGridNo; this->iSoundID = src.iSoundID; - this->ubLastTargetTakenDamage = src.ubLastTargetTakenDamage; + this->ubLastTargetTakenDamage = static_cast(src.ubLastTargetTakenDamage); return *this; } @@ -1120,10 +1120,10 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) { gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( String( "Incrementing attack busy because of delayed water explosion. Now %d\n", gTacticalStatus.ubAttackBusyCount ) ); - AniParams.ubKeyFrame1 = 11; + AniParams.ubKeyFrame1 = 11; AniParams.uiKeyFrame1Code = ANI_KEYFRAME_CHAIN_WATER_EXPLOSION; AniParams.uiUserData = pObject->Obj.usItem; - AniParams.ubUserData2 = pObject->ubOwner; + AniParams.ubUserData2 = pObject->ubOwner; } pNode = CreateAnimationTile( &AniParams );