diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 9dceea5d..92b1bd3b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -2687,7 +2687,7 @@ void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, B void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, INT32 sGridNo, UINT8 bLevel, UINT8 ubId, - UINT8 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ) + UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ) { const char* filename = "scripts\\Overhead.lua"; diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index ed419d1b..cd663ede 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -62,7 +62,7 @@ extern BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fFirstTime ); void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, INT32 sGridNo, UINT8 bLevel, UINT8 ubId, - UINT8 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ); + UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ); void LuaRecruitRPCAdditionalHandling( UINT8 usProfile ); void LuaHandleSectorTacticalEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fHasEverBeenPlayerControlled ); diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 9d669ecf..a8bfc29e 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -291,7 +291,7 @@ void HandlePossibleArmsDealerIntelRefresh( BOOLEAN aForceReread ) pDealerInv[cnt].uiIndex = cnt; pDealerInv[cnt].sItemIndex = data.usItem; - pDealerInv[cnt].ubOptimalNumber = data.sOptimalNumber; + pDealerInv[cnt].ubOptimalNumber = (UINT8)data.sOptimalNumber; ++cnt; } diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index 4516d1af..9e018066 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -821,7 +821,7 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) } } -DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID ) +DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT16 ubArmsDealerID ) { switch( ubArmsDealerID ) { @@ -921,7 +921,7 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID { if ( ubArmsDealerID < NUM_ARMS_DEALERS ) { - UINT8 additionaldealernumber = ubArmsDealerID - ARMS_DEALER_ADDITIONAL_1; + UINT16 additionaldealernumber = ubArmsDealerID - ARMS_DEALER_ADDITIONAL_1; return( gArmsDealerAdditional[additionaldealernumber] ); } } diff --git a/Tactical/ArmsDealerInvInit.h b/Tactical/ArmsDealerInvInit.h index 89c9b9b4..50f75e64 100644 --- a/Tactical/ArmsDealerInvInit.h +++ b/Tactical/ArmsDealerInvInit.h @@ -39,7 +39,7 @@ typedef struct INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ); -DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID ); +DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT16 ubArmsDealerID ); UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex ); UINT8 ChanceOfItemTransaction( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEAN fDealerSelling, BOOLEAN fUsed ); diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 18fd8c11..b17b35f8 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -777,8 +777,7 @@ void HandleDynamicOpinionSpeechEvents( ) // award any opinion events that have happened... // these better not start dialogues themselves, or we might cause a loop here - UINT16 opinioneentscollectedsize = gOpionionEventsDuringDialogue.size( ); - for ( UINT16 i = 0; i < opinioneentscollectedsize; ++i ) + for ( size_t i = 0, opinioneentscollectedsize = gOpionionEventsDuringDialogue.size(); i < opinioneentscollectedsize; ++i ) { OpinionEvent event = gOpionionEventsDuringDialogue[i]; @@ -1080,8 +1079,7 @@ INT8 GetSidePosition( UINT8 aDostPosition ) { INT8 bestpos = -1; - UINT8 size = gDynamicOpinionSpeechInCurrentDialogue.size( ); - for ( UINT8 i = 0; i < size; ++i ) + for ( size_t i = 0, size = gDynamicOpinionSpeechInCurrentDialogue.size(); i < size; ++i ) { if ( gDynamicOpinionSpeechInCurrentDialogue[i].usSide == aDostPosition ) { @@ -1779,7 +1777,7 @@ void HandleDynamicOpinionBattleFinished( BOOLEAN fBattleWon ) UINT32 enemysidesize = 0; // pick the 'leader' who gets all the praise (or blame, depending on how this went) - UINT8 leaderid = GetBestMercLeaderInSector( SECTORX( gCurrentIncident.usSector ), SECTORY( gCurrentIncident.usSector ), (INT8)gCurrentIncident.usLevel ); + UINT16 leaderid = GetBestMercLeaderInSector( SECTORX( gCurrentIncident.usSector ), SECTORY( gCurrentIncident.usSector ), (INT8)gCurrentIncident.usLevel ); if ( leaderid != NOBODY ) { @@ -1825,7 +1823,7 @@ void HandleDynamicOpinionRetreat( ) { // This was a disaster (Ignoring of how high the enemies losses were to create drama :-) )! Let's blame the player -> blame an IMP! std::vector aTaboo; - UINT8 impid = GetBestMercLeaderInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + UINT16 impid = GetBestMercLeaderInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); // we've found someone competent. Let's all blame him for this disaster! if ( impid != NOBODY ) @@ -1936,10 +1934,10 @@ UINT32 GetSoldierLeaderRating( SOLDIERTYPE* pSoldier ) } -UINT8 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ) +UINT16 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ) { UINT32 highestrating = 0; - UINT8 bestid = NOBODY; + UINT16 bestid = NOBODY; SOLDIERTYPE* pSoldier = NULL; UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; diff --git a/Tactical/DynamicDialogue.h b/Tactical/DynamicDialogue.h index c4f0484d..2eca4b6b 100644 --- a/Tactical/DynamicDialogue.h +++ b/Tactical/DynamicDialogue.h @@ -480,7 +480,7 @@ void HandleDynamicOpinionTeaching( SOLDIERTYPE* pSoldier, UINT8 ubStat ); // some events require a 'leader' - merc the team will regard as the one being in charge, and subsequently being praised or damned for the way things develop UINT32 GetSoldierLeaderRating( SOLDIERTYPE* pSoldier ); -UINT8 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ); +UINT16 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ); // get id of a random merc in a sector, provided one exists UINT8 GetRandomMercInSectorNotInList( INT16 sX, INT16 sY, INT8 sZ, std::vector aTaboo, BOOLEAN fImpOnly ); diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 10e8cb39..ad5e0b5f 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -7679,8 +7679,7 @@ BOOLEAN RemoveFortification( INT32 sGridNo, SOLDIERTYPE *pSoldier, OBJECTTYPE *p // We only want to do this on the earth piles, of course - flattening crates via a shovel would be odd :-) UINT8 numbertofind = (UINT8)(pStruct->pDBStructureRef->pDBStructure->usStructureNumber); - UINT8 size = gStructureDeconstruct[i].tilevector.size(); - for ( UINT8 j = 0; j < size; ++j) + for ( size_t j = 0, size = gStructureDeconstruct[i].tilevector.size(); j < size; ++j) { if ( gStructureDeconstruct[i].tilevector[j] == numbertofind ) { @@ -7988,8 +7987,7 @@ BOOLEAN CanRemoveFortification( INT32 sGridNo, INT8 sLevel, UINT32 usStructureco // We only want to do this on the earth piles, of course - flattening crates via a shovel would be odd :-) UINT8 numbertofind = (UINT8)(pStruct->pDBStructureRef->pDBStructure->usStructureNumber); - UINT8 size = gStructureDeconstruct[usStructureconstructindex].tilevector.size( ); - for ( UINT8 j = 0; j < size; ++j ) + for ( size_t j = 0, size = gStructureDeconstruct[usStructureconstructindex].tilevector.size(); j < size; ++j ) { if ( gStructureDeconstruct[usStructureconstructindex].tilevector[j] == numbertofind ) { @@ -8187,8 +8185,7 @@ BOOLEAN RemoveFortification( INT32 sGridNo, INT8 sLevel, UINT32 usStructureconst // We only want to do this on the earth piles, of course - flattening crates via a shovel would be odd :-) UINT8 numbertofind = (UINT8)(pStruct->pDBStructureRef->pDBStructure->usStructureNumber); - UINT8 size = gStructureDeconstruct[usStructureconstructindex].tilevector.size( ); - for ( UINT8 j = 0; j < size; ++j ) + for ( size_t j = 0, size = gStructureDeconstruct[usStructureconstructindex].tilevector.size(); j < size; ++j ) { if ( gStructureDeconstruct[usStructureconstructindex].tilevector[j] == numbertofind ) { diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 36cc5cc7..55bd75b2 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -162,8 +162,7 @@ bool DestroyLBEIfEmpty(OBJECTTYPE* pObj, int stackIndex) LBENODE* pLBE = pObj->GetLBEPointer(stackIndex); if (pLBE) { - UINT16 plbesize = pLBE->inv.size(); - for (UINT16 x = 0; x < plbesize; ++x) + for ( size_t x = 0, plbesize = pLBE->inv.size(); x < plbesize; ++x) { if (pLBE->inv[x].exists() == true) return false; @@ -189,8 +188,7 @@ void DestroyLBE(OBJECTTYPE* pObj, int stackIndex) LBENODE* pLBE = pObj->GetLBEPointer(stackIndex); if(pLBE) { - UINT16 plbesize = pLBE->inv.size(); - for(UINT16 x = 0; x < plbesize; ++x) + for(size_t x = 0, plbesize = pLBE->inv.size(); x < plbesize; ++x) { if(pLBE->inv[x].exists() == true) { @@ -217,16 +215,15 @@ void DestroyLBE(OBJECTTYPE* pObj, int stackIndex) void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector& LBESlots, LBENODE* pLBE, OBJECTTYPE* pObj) { - UINT16 plbesize = pLBE->inv.size(); - UINT16 lbesize = LBESlots.size(); - for(UINT16 i=0; iinv.size(); + for( size_t i=0, lbesize = LBESlots.size(); iinv[LBESlots[i]].exists() == false) // No item in this pocket continue; // Found an item in a default pocket so get it's ItemSize UINT16 dSize = CalculateItemSize(&pSoldier->inv[LBESlots[i]]); - for(unsigned int j=0; jinv[j].exists() == true) // Item already stored in LBENODE pocket continue; @@ -464,13 +461,12 @@ BOOLEAN MoveItemFromLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, OBJECTTYPE //we should have copied all the items from the LBE to the soldier //which means the LBE should be empty and destroyed. However, if it's not empty, we need to force place //some items so that we can empty the LBE without losing anything. - UINT16 invsize = pSoldier->inv.size(); - UINT16 lbesize = LBESlots.size(); - for(UINT16 i = 0; i < lbesize; ++i) + size_t invsize = pSoldier->inv.size(); + for(size_t i = 0, lbesize = LBESlots.size(); i < lbesize; ++i) { if(pLBE->inv[i].exists() == true) { - for(UINT16 j = BIGPOCKSTART; j < invsize; ++j) + for( size_t j = BIGPOCKSTART; j < invsize; ++j) { if(pSoldier->inv[j].exists() == false) { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index bf664c27..76a3feb4 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -2874,8 +2874,8 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject ) UINT16 pIndex, testSize, maxSize; UINT8 pocketCapacity, numberOfSizeIncrements; FLOAT currentPocketPercent, currentPocketPartOfTotal; - UINT16 invsize = pLBE->inv.size(); - for(UINT16 x = 0; x < invsize; ++x) + size_t invsize = pLBE->inv.size(); + for( size_t x = 0; x < invsize; ++x) { if(LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x] != 0) { @@ -2884,7 +2884,7 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject ) } } //Now, look through each active pocket - for(UINT16 x = 0; x < invsize; ++x) + for( size_t x = 0; x < invsize; ++x) { if ( pLBE->inv[x].exists() ) { @@ -3044,8 +3044,7 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index) LBENODE* pLBE = GetLBEPointer( index ); if ( pLBE ) { - UINT16 invsize = pLBE->inv.size(); - for ( UINT16 subObjects = 0; subObjects < invsize; ++subObjects ) + for ( size_t subObjects = 0, invsize = pLBE->inv.size(); subObjects < invsize; ++subObjects ) { if ( pLBE->inv[subObjects].exists() == true ) { @@ -8723,8 +8722,7 @@ BOOLEAN RemoveObjectFromSoldierProfile( UINT8 ubProfile, UINT16 usItem ) return( TRUE ); } MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ]; - UINT8 invsize = pProfile->inv.size(); - for (UINT8 bLoop = 0; bLoop < invsize; ++bLoop) + for (size_t bLoop = 0, invsize = pProfile->inv.size(); bLoop < invsize; ++bLoop) { if ( pProfile->inv[ bLoop ] == usItem ) { diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index ef460260..ad85a99c 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -6678,8 +6678,7 @@ INT8 FireBulletGivenTarget_NoObjectNoSoldier( UINT16 usItem, UINT8 ammotype, UIN ddHorizAngle, ddVerticAngle, NOBODY, ubLoop, ubShots, gpSpreadPattern[ubSpreadIndex].method, gSpreadPatternMethodNames[gpSpreadPattern[ubSpreadIndex].method], - ubSpreadIndex, gpSpreadPattern[ubSpreadIndex].Name, - NULL + ubSpreadIndex, gpSpreadPattern[ubSpreadIndex].Name ); fclose( OutFile ); } diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 402a9466..3cee7bf0 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -1468,8 +1468,8 @@ void HandleSnitchesReports( std::vector& aVec ) SOLDIERTYPE *pSnitch; BOOLEAN fSleepingSnitch = FALSE; - UINT16 size = aVec.size( ); - for ( UINT16 bCounter = 0; bCounter < size; ++bCounter ) + size_t size = aVec.size( ); + for ( size_t bCounter = 0; bCounter < size; ++bCounter ) { SnitchEvent& event = aVec[bCounter]; @@ -1497,7 +1497,7 @@ void HandleSnitchesReports( std::vector& aVec ) SnitchTacticalCharacterDialogue( pSnitch, 0, SNITCH_INTRODUCTION, NO_PROFILE, NO_PROFILE ); // process all reports by the same snitch in row - for ( UINT16 bCounter2 = bCounter; bCounter2 < size; ++bCounter2 ) + for ( size_t bCounter2 = bCounter; bCounter2 < size; ++bCounter2 ) { SnitchEvent& event2 = aVec[bCounter2]; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 8b07fdcc..3c770e8c 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -4161,7 +4161,7 @@ INT16 GetAPsForMultiTurnAction( SOLDIERTYPE *pSoldier, UINT8 usActionType ) return sAPCost; } -INT16 GetAPsForInteractiveAction( SOLDIERTYPE *pSoldier, UINT8 usActionType ) +INT16 GetAPsForInteractiveAction( SOLDIERTYPE *pSoldier, UINT16 usActionType ) { INT16 sAPCost = 0; diff --git a/Tactical/Points.h b/Tactical/Points.h index 250c980a..52ccd3ab 100644 --- a/Tactical/Points.h +++ b/Tactical/Points.h @@ -356,7 +356,7 @@ INT16 GetAPsToApplyItem( SOLDIERTYPE *pSoldier, INT32 usMapPos ); // added by Fl INT16 GetAPsToFillBloodbag( SOLDIERTYPE *pSoldier, INT32 usMapPos ); // added by Flugente INT16 GetAPsForMultiTurnAction( SOLDIERTYPE *pSoldier, UINT8 usActionType ); // added by Flugente -INT16 GetAPsForInteractiveAction( SOLDIERTYPE *pSoldier, UINT8 usActionType ); // added by Flugente +INT16 GetAPsForInteractiveAction( SOLDIERTYPE *pSoldier, UINT16 usActionType ); // added by Flugente INT16 GetAPsToJumpOver( SOLDIERTYPE *pSoldier );