From e9c8124dc2a069fd9535d8a8405d5c5907b35856 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:05:19 +0200 Subject: [PATCH] Fix UB compilation --- Strategic/Queen Command.cpp | 12 ++++++------ Tactical/Ja25_Tactical.cpp | 18 +++++++++--------- Tactical/Ja25_Tactical.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 23bddfc8..487ee8fe 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -3158,8 +3158,8 @@ void HandleBloodCatDeaths( SECTORINFO *pSector ) //if ALL the bloodcats are killed if( pSector->bBloodCats == 0 ) { - UINT8 bId1=-1; - UINT8 bId2=-1; + SoldierID bId1 = NOBODY; + SoldierID bId2 = NOBODY; UINT8 bNum=0; SetFactTrue( FACT_PLAYER_KILLED_ALL_BETTYS_BLOODCATS ); @@ -3174,13 +3174,13 @@ void HandleBloodCatDeaths( SECTORINFO *pSector ) if( bNum != 0 ) { //must make sure TEX doesnt say the quote - if( bId1 != NOBODY && Menptr[ bId1 ].ubProfile != TEX_UB ) + if( bId1 != NOBODY && bId1->ubProfile != TEX_UB ) { - TacticalCharacterDialogue( &Menptr[ bId1 ], QUOTE_UB_HANDLE_BLOODCATDEATHS ); + TacticalCharacterDialogue( bId1, QUOTE_UB_HANDLE_BLOODCATDEATHS ); } - else if( bId2 != NOBODY && Menptr[ bId2 ].ubProfile != TEX_UB ) + else if( bId2 != NOBODY && bId2->ubProfile != TEX_UB ) { - TacticalCharacterDialogue( &Menptr[ bId2 ], QUOTE_UB_HANDLE_BLOODCATDEATHS ); + TacticalCharacterDialogue( bId2, QUOTE_UB_HANDLE_BLOODCATDEATHS ); } } } diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 4893ce49..417dc46e 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -84,7 +84,7 @@ typedef struct //Morris items //UINT32 MORRIS_INSTRUCTION_NOTE = 1362; -UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); +UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ); //******************************************************************* // @@ -584,7 +584,7 @@ UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) return( usNumMercsPresent ); } -UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ) +UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ) { UINT8 usNumMercs; UINT8 RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ]; @@ -875,20 +875,20 @@ void HandlePowerGenAlarm() } else { - UINT8 bSoldierId1, bSoldierId2, bSoldierId3; + SoldierID bSoldierId1, bSoldierId2, bSoldierId3; Get3RandomQualifiedMercs( &bSoldierId1, &bSoldierId2, &bSoldierId3 ); - if( bSoldierId1 != -1 && Menptr[ bSoldierId1 ].ubProfile != BIGGENS_UB ) //BIGGENS + if( bSoldierId1 != NOBODY && bSoldierId1->ubProfile != BIGGENS_UB ) //BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId1 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId1, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } - else if( bSoldierId2 != -1 && Menptr[ bSoldierId2 ].ubProfile != BIGGENS_UB ) //BIGGENS + else if( bSoldierId2 != NOBODY && bSoldierId2->ubProfile != BIGGENS_UB ) //BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId2 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId2, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } - else if( bSoldierId3 != -1 && Menptr[ bSoldierId3 ].ubProfile != BIGGENS_UB ) // BIGGENS + else if( bSoldierId3 != NOBODY && bSoldierId3->ubProfile != BIGGENS_UB ) // BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId3 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId3, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } } } diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 4f086238..a8b12371 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -50,7 +50,7 @@ BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQu UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ); -extern UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); +extern UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ); void HandleWhenCertainPercentageOfEnemiesDie(); @@ -151,4 +151,4 @@ extern void InitGridNoUB(); #endif -#endif \ No newline at end of file +#endif