mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Fix UB compilation
This commit is contained in:
@@ -5484,7 +5484,7 @@ BOOLEAN IsMineEntranceInSectorI13AtThisGridNo( UINT32 sGridNo )
|
|||||||
void HaveBiggensDetonatingExplosivesByTheMine()
|
void HaveBiggensDetonatingExplosivesByTheMine()
|
||||||
{
|
{
|
||||||
SOLDIERTYPE *pSoldier = NULL;
|
SOLDIERTYPE *pSoldier = NULL;
|
||||||
UINT8 ubID=NOBODY;
|
SoldierID ubID = NOBODY;
|
||||||
|
|
||||||
pSoldier = FindSoldierByProfileID( BIGGENS_UB , FALSE ); //BIGGENS
|
pSoldier = FindSoldierByProfileID( BIGGENS_UB , FALSE ); //BIGGENS
|
||||||
if( pSoldier != NULL )
|
if( pSoldier != NULL )
|
||||||
@@ -5638,7 +5638,7 @@ void HandleRaulBlowingHimselfUp()
|
|||||||
usItem = HAND_GRENADE;
|
usItem = HAND_GRENADE;
|
||||||
INT16 sX, sY;
|
INT16 sX, sY;
|
||||||
ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY);
|
ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY);
|
||||||
IgniteExplosion( RAUL_UB, sX, sY, 0, pSoldier->sGridNo, usItem, pSoldier->pathing.bLevel );
|
IgniteExplosion( pSoldier->ubID, sX, sY, 0, pSoldier->sGridNo, usItem, pSoldier->pathing.bLevel );
|
||||||
|
|
||||||
SetJa25GeneralFlag( JA_GF__RAUL_BLOW_HIMSELF_UP );
|
SetJa25GeneralFlag( JA_GF__RAUL_BLOW_HIMSELF_UP );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4338,7 +4338,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_EXPLODE_DOOR], APBPConstants[BP_EXPLODE_DOOR], FALSE ) )
|
if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_EXPLODE_DOOR], APBPConstants[BP_EXPLODE_DOOR], FALSE ) )
|
||||||
{
|
{
|
||||||
// Set UI
|
// Set UI
|
||||||
SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID );
|
SetUIBusy( gOpenDoorMenu.pSoldier->ubID );
|
||||||
|
|
||||||
InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXPLODE );
|
InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXPLODE );
|
||||||
}
|
}
|
||||||
@@ -4397,7 +4397,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) )
|
if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) )
|
||||||
{
|
{
|
||||||
// Set UI
|
// Set UI
|
||||||
SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID );
|
SetUIBusy( gOpenDoorMenu.pSoldier->ubID );
|
||||||
|
|
||||||
InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_CROWBAR );
|
InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_CROWBAR );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ SoldierID RandomSoldierIdFromNewMercsOnPlayerTeam()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
|
UINT8 RandomArrayOfQualifiedMercs( SoldierID *pRandomSoldierIdArray )
|
||||||
{
|
{
|
||||||
UINT8 usNumMercsPresent;
|
UINT8 usNumMercsPresent;
|
||||||
SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
|
SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
|
||||||
@@ -586,9 +586,9 @@ UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
|
|||||||
|
|
||||||
UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 )
|
UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 )
|
||||||
{
|
{
|
||||||
UINT8 usNumMercs;
|
UINT8 usNumMercs;
|
||||||
UINT8 RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ];
|
SoldierID RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ];
|
||||||
UINT8 ubNumberDifMercsAssigned=0;
|
UINT8 ubNumberDifMercsAssigned=0;
|
||||||
|
|
||||||
usNumMercs = RandomArrayOfQualifiedMercs( RandomSoldierIdArray );
|
usNumMercs = RandomArrayOfQualifiedMercs( RandomSoldierIdArray );
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQu
|
|||||||
|
|
||||||
//Pass in an array of size NUM_MERCS_WITH_NEW_QUOTES, array will be filled with
|
//Pass in an array of size NUM_MERCS_WITH_NEW_QUOTES, array will be filled with
|
||||||
//random soldier IDs of the qualified mercs
|
//random soldier IDs of the qualified mercs
|
||||||
UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray );
|
UINT8 RandomArrayOfQualifiedMercs( SoldierID *pRandomSoldierIdArray );
|
||||||
|
|
||||||
|
|
||||||
extern UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 );
|
extern UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 );
|
||||||
|
|||||||
@@ -393,13 +393,13 @@ typedef struct SoldierID
|
|||||||
if ( i > TOTAL_SOLDIERS )
|
if ( i > TOTAL_SOLDIERS )
|
||||||
i = TOTAL_SOLDIERS;
|
i = TOTAL_SOLDIERS;
|
||||||
}
|
}
|
||||||
SoldierID ( const UINT32 val ) : i ( val )
|
SoldierID( const UINT32 val ) : i( val )
|
||||||
{
|
{
|
||||||
// Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid
|
// Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid
|
||||||
if ( i > TOTAL_SOLDIERS )
|
if ( i > TOTAL_SOLDIERS )
|
||||||
i = TOTAL_SOLDIERS;
|
i = TOTAL_SOLDIERS;
|
||||||
}
|
}
|
||||||
SoldierID ( const INT32 val ) : i ( val )
|
constexpr SoldierID( const INT32 val ) : i( val )
|
||||||
{
|
{
|
||||||
// Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid
|
// Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid
|
||||||
if ( i > TOTAL_SOLDIERS )
|
if ( i > TOTAL_SOLDIERS )
|
||||||
@@ -407,8 +407,8 @@ typedef struct SoldierID
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No conversions from 8-bit integers!
|
// No conversions from 8-bit integers!
|
||||||
SoldierID ( const UINT8 ) = delete;
|
SoldierID( const UINT8 ) = delete;
|
||||||
SoldierID ( const INT8 ) = delete;
|
SoldierID( const INT8 ) = delete;
|
||||||
|
|
||||||
|
|
||||||
SOLDIERTYPE* operator->() { return MercPtrs[i]; }
|
SOLDIERTYPE* operator->() { return MercPtrs[i]; }
|
||||||
@@ -488,5 +488,5 @@ inline SoldierID operator++(SoldierID lhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore.
|
//TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore.
|
||||||
inline const SoldierID NOBODY{ TOTAL_SOLDIERS };
|
inline constexpr SoldierID NOBODY{ TOTAL_SOLDIERS };
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user