- Fix: UB cannot be compiled

- Fixed a few compiler warnings

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8176 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-04-24 19:59:25 +00:00
parent 38814f5ee3
commit bd59b2fcba
16 changed files with 31 additions and 45 deletions
+2 -3
View File
@@ -248,7 +248,7 @@ void RenderBriefingRoomEnter()
HVOBJECT hContentButtonHandle;
UINT16 usWidth=0;
HVOBJECT hHandle;
//HVOBJECT hHandle;
DrawBriefingRoomEnterDefaults();
@@ -385,8 +385,7 @@ BOOLEAN DisplayBriefingRoomEnterCopyright()
void DisplayPlayerActivationBriefingRoomEnterString( void )
{
HVOBJECT hHandle;
//HVOBJECT hHandle;
// this function will grab the string that the player will enter for activation
+1 -1
View File
@@ -1144,7 +1144,7 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
{
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
SGPPoint pPosition;
//SGPPoint pPosition;
// Delete popup!
RemoveMercPopupBoxFromIndex( gMsgBox.iBoxId );
+7 -9
View File
@@ -124,15 +124,14 @@ JA25_SECTOR_AI_MANAGER gJa25StrategicAi;
BOOLEAN AddEnemiesToInitialSectorH7();
UINT32 GetNumberOfJA25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 *pNumAdmins, UINT8 *pNumTroops, UINT8 *pNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps );
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void InitJa25InitialEnemiesInSector();
void InitJa25UnderGroundSectors();
void InitNumberOfEnemiesInAboveGroundSectors( );
void InitNumberOfEnemiesInUnderGroundSectors( );
void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements );
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps );
void ResetJa25SectorProbabilities();
BOOLEAN InitJa25StrategicSectorAI( BOOLEAN fReset );
@@ -427,16 +426,14 @@ void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ
}
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps )
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps )
{
SECTORINFO *pSector;
pSector = &SectorInfo[ iSectorID ];
SECTORINFO* pSector = &SectorInfo[iSectorID];
pSector->ubNumAdmins = ubNumAdmins;
pSector->ubNumTroops = ubNumTroops;
pSector->ubNumElites = ubNumElites;
pSector->ubNumTanks = ubNumTanks;
pSector->ubNumJeeps = ubJeeps;
pSector->ubNumJeeps = ubNumJeeps;
}
void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements )
@@ -449,7 +446,7 @@ void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8
pSector->bBloodCatPlacements = bBloodCatPlacements;
}
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks )
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps )
{
UNDERGROUND_SECTORINFO *pSector=NULL;
@@ -461,6 +458,7 @@ void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, IN
pSector->ubNumTroops = ubNumTroops;
pSector->ubNumElites = ubNumElites;
pSector->ubNumTanks = ubNumTanks;
pSector->ubNumJeeps = ubNumJeeps;
}
void InitNumberOfEnemiesInAboveGroundSectors( )
+2 -4
View File
@@ -188,12 +188,12 @@ BOOLEAN ShouldEnemiesBeAddedToInitialSector();
void InitJa25StrategicAi();
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void InitJa25SaveStruct();
void InitJa25StrategicAiBloodcats( );
extern void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps );
BOOLEAN SaveJa25SaveInfoToSaveGame( HWFILE hFile );
BOOLEAN LoadJa25SaveInfoFromSavedGame( HWFILE hFile );
@@ -305,7 +305,6 @@ enum
extern BOOLEAN gfEnemyShouldImmediatelySeekThePlayer;
//extern INT32 giNumJA25Sectors;
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
void SetJa25SectorOwnedStatus( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fPlayerOwned );
INT8 GetTheFurthestSectorPlayerOwns();
void Ja25_UpdateTimeOfEndOfLastBattle( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
@@ -317,7 +316,6 @@ void JA25_HandleUpdateOfStrategicAi();
void SetEnemiesToFindThePlayerMercs();
void HandleSayingDontStayToLongWarningInSectorH8();
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
#ifdef JA2BETAVERSION
BOOLEAN InitJa25StrategicAiDecisions( BOOLEAN fLoadedGame );
-1
View File
@@ -498,7 +498,6 @@ UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLE
BOOLEAN bCivHighLoyalty = FALSE;
BOOLEAN bMiners = FALSE;
UINT16 iCounter2;
UINT16 FileEDTQUoteID;
(*pubCivHintToUse) = 0;
+5 -6
View File
@@ -4361,7 +4361,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
void INVRenderSteeringWheel( UINT32 uiBuffer, UINT32 uiSteeringWheelIndex, SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, UINT8 fDirtyLevel )
{
SOLDIERTYPE *pVehicle = NULL;
UINT32 usHeight, usWidth;
INT16 sNewY, sNewX;
static CHAR16 pStr[ 100 ], pStr2[ 100 ];
@@ -7585,16 +7584,16 @@ void RenderItemDescriptionBox( )
{
if ( !Weapon[gpComparedItemDescObject->usItem].NoSemiAuto )
{
UINT8 ubComparedAttackAPs = BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], gpComparedItemDescObject, NULL );
if( ubComparedAttackAPs > ubAttackAPs )
INT16 sComparedAttackAPs = BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], gpComparedItemDescObject, NULL );
if ( sComparedAttackAPs > ubAttackAPs )
{
SetFontForeground( ITEMDESC_FONTNEGATIVE );
swprintf( pStr, L"+%2d", ubComparedAttackAPs - ubAttackAPs );
swprintf( pStr, L"+%2d", sComparedAttackAPs - ubAttackAPs );
}
else if( ubComparedAttackAPs < ubAttackAPs )
else if ( sComparedAttackAPs < ubAttackAPs )
{
SetFontForeground( ITEMDESC_FONTPOSITIVE );
swprintf( pStr, L"%2d", ubComparedAttackAPs - ubAttackAPs );
swprintf( pStr, L"%2d", sComparedAttackAPs - ubAttackAPs );
}
else
swprintf( pStr, L"=");
+1 -1
View File
@@ -1026,7 +1026,7 @@ void HandleFirstHeliDropOfGame( )
CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 );
}
UINT16 SpawnAirDropElite( INT32 sGridNo )
UINT8 SpawnAirDropElite( INT32 sGridNo )
{
SOLDIERTYPE *pSoldier;
+1 -1
View File
@@ -150,7 +150,7 @@ TraitSelection::Setup( UINT32 aVal )
INT16 sX, sY;
// sevenfm: changed TraitsMenu position from soldier to mouse
//GetSoldierScreenPos( pSoldier, &sX, &sY );
GetGridNoScreenPos( sTraitsMenuTargetGridNo, gsInterfaceLevel, &sX, &sY );
GetGridNoScreenPos( sTraitsMenuTargetGridNo, (UINT8)gsInterfaceLevel, &sX, &sY );
if( sX < 0 ) sX = 0;
if( sY < 0 ) sY = 0;
+1 -1
View File
@@ -22844,7 +22844,7 @@ void HandleVolunteerRecruitment( SOLDIERTYPE* pRecruiter, SOLDIERTYPE* pTarget )
// bonus for assertive characters
if ( DoesMercHavePersonality( pRecruiter, CHAR_TRAIT_ASSERTIVE ) )
leadershipfactor *= 1.05;
leadershipfactor *= 1.05f;
FLOAT recruitmodifier = (100 + pRecruiter->GetBackgroundValue( BG_PERC_APPROACH_RECRUIT )) / 100.0f;
-6
View File
@@ -4161,12 +4161,6 @@ UINT8 GetLocationModifier( UINT8 ubSoldierClass )
{
UINT8 ubLocationModifier = 0;
INT16 sSectorX, sSectorY, sSectorZ;
#ifdef JA2UB
#else
//INT8 bTownId;
//UINT8 ubPalaceDistance;
#endif
BOOLEAN fSuccess;
// Flugente: why do we always crash the game if something does not work?
// where is all this taking place?
+2 -2
View File
@@ -3093,7 +3093,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
GetMouseMapPos( &sGridNo );
// a node to add a structure
AddFortificationPlanNode( sGridNo, gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, TRUE );
AddFortificationPlanNode( sGridNo, (INT8)gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, TRUE );
}
else if ( fAlt )
{
@@ -3145,7 +3145,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
GetMouseMapPos( &sGridNo );
// a node to delete a structure
AddFortificationPlanNode( sGridNo, gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, FALSE );
AddFortificationPlanNode( sGridNo, (INT8)gsInterfaceLevel, gCurrentFortificationStructure, gCurrentFortificationTileLibraryIndex, FALSE );
}
else
{
+1 -1
View File
@@ -132,7 +132,7 @@ VehicleSelection::Setup( UINT32 aVal )
// grab soldier's x,y screen position
INT16 sX, sY;
GetGridNoScreenPos( sVehicleMenuTargetGridNo, gsInterfaceLevel, &sX, &sY );
GetGridNoScreenPos( sVehicleMenuTargetGridNo, (UINT8)gsInterfaceLevel, &sX, &sY );
if( sX < 0 ) sX = 0;
if( sY < 0 ) sY = 0;
+1 -1
View File
@@ -154,7 +154,7 @@ diseaseEndElementHandle( void *userData, const XML_Char *name )
else if ( strcmp( name, "uiIndex" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curItem.uiIndex = (UINT16)atol( pData->szCharData );
pData->curItem.uiIndex = (UINT8)atol( pData->szCharData );
}
else if ( strcmp( name, "szName" ) == 0 )
{
+1 -1
View File
@@ -14,7 +14,7 @@ void StartHelicopterRun();
void HandleHeliDrop( BOOLEAN fPlayer = TRUE );
UINT16 SpawnAirDropElite( INT32 sGridNo );
UINT8 SpawnAirDropElite( INT32 sGridNo );
void InitiateEnemyAirDropSoldiers( INT32 sGridNo );
void HandleEnemyAirdrop( );
+5 -6
View File
@@ -511,7 +511,7 @@ INT32 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT32 sSwee
}
}
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadius )
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT16 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
@@ -522,9 +522,8 @@ INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadiu
INT32 leftmost;
BOOLEAN fFound = FALSE;
EXITGRID ExitGrid;
sTop = ubRadius;
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
@@ -532,11 +531,11 @@ INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadiu
//clear the mapelements of potential residue MAPELEMENT_REACHABLE flags
uiLowestRange = 999999;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
for( cnt1 = sBottom; cnt1 <= sTop; ++cnt1 )
{
leftmost = ( ( sSrcGridNo + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
for( cnt2 = sLeft; cnt2 <= sRight; ++cnt2 )
{
sGridNo = sSrcGridNo + ( WORLD_COLS * cnt1 ) + cnt2;
if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) )
+1 -1
View File
@@ -51,6 +51,6 @@ extern BOOLEAN gfShowExitGrids;//dnl ch86 190214
// Finds closest ExitGrid of same type as is at gridno, within a radius. Checks
// valid paths, destinations, etc.
INT32 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT32 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection );
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadius );
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT16 ubRadius );
#endif