Fix: compiler warnings

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8814 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-05-30 14:26:16 +00:00
parent e932393eae
commit b25a4be4e7
15 changed files with 49 additions and 68 deletions
+2 -2
View File
@@ -95,8 +95,8 @@ DropDownBase::Init( UINT16 sX, UINT16 sY )
mFirstShownEntry = max( 0, min( mFirstShownEntry, mEntryVector.size( ) - 1 - mNumDisplayedEntries ) );
musWidth = 0;
UINT16 size = mEntryVector.size( );
for ( UINT16 i = 0; i < size; ++i )
size_t size = mEntryVector.size();
for ( size_t i = 0; i < size; ++i )
{
musWidth = max( musWidth, StringPixLength( mEntryVector[i].second, DEF_DROPDOWN_FONT ) );
}
+2 -4
View File
@@ -439,8 +439,7 @@ IMPDialogueChooseBox::Init( UINT16 sX, UINT16 sY )
musWidth = 0;
UINT16 size = mEntryVector.size( );
for ( UINT16 i = 0; i < size; ++i )
for ( size_t i = 0, size = mEntryVector.size(); i < size; ++i )
{
musWidth = max( musWidth, StringPixLength( mEntryVector[i].second, MYBOX_FONT_DEF ) );
}
@@ -463,8 +462,7 @@ IMPDialogueChooseBox::Create( UINT16 sX, UINT16 sY )
sY += IMPDIALOGUECHOOSEBOX_BAR_Y_OFFSET;
UINT16 size = mEntryVector.size( );
for ( UINT16 i = 0; i < size; ++i )
for ( size_t i = 0, size = mEntryVector.size(); i < size; ++i )
{
if ( !mChoiceRegionDefined[i] )
{
+3 -7
View File
@@ -132,11 +132,7 @@ void DisplayDefaults_IM()
GetVideoObject( &hPixHandle, guiMercCompareLogoImage );
SetFontShadow( MERCOMP_FONT_SHADOW );
CHAR16 sText[800];
UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X;
UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
WebPageTileBackground( 4, 4, BACKGROUND_WIDTH, CAMPAIGN_HISTORY_BACKGROUND_HEIGHT, guiInsuranceBackGround );
//Display the title slogan
@@ -145,8 +141,8 @@ void DisplayDefaults_IM()
//Display the subtitle slogan
DrawTextToScreen( szIntelWebsiteText[TEXT_INTEL_SUBTITLE], CAMPAIGN_HISTORY_SUBTITLE_X, CAMPAIGN_HISTORY_SUBTITLE_Y, 0, CAMPHIS_FONT_BIG, MERCOMP_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosX = CAMPAIGN_HISTORY_LINK_START_X;
usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X;
UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
for ( int i = 0; i<NUM_LINKS; ++i )
{
DisplayWrappedString( usPosX, usPosY, CAMPAIGN_HISTORY_LINK_TEXT_WIDTH, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, szIntelWebsiteText[TEXT_INTEL_LINK_1 + i], FONT_MCOLOR_BLACK, FALSE, 0 );
-2
View File
@@ -2555,8 +2555,6 @@ UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter )
// Flugente: simple wrapper to check whether an audio file in mp3/ogg/wav format exists
BOOLEAN SoundFileExists( STR strFilename, STR zFoundFilename )
{
SGPFILENAME zFilename;
sprintf( zFoundFilename, "%s.mp3", strFilename );
if ( !FileExists( zFoundFilename ) )
{
+3 -2
View File
@@ -8894,8 +8894,9 @@ void HandleTrainWorkers()
}
}
if ( totalworkersadded * gGameExternalOptions.usWorkerTrainingCost > 0 )
AddTransactionToPlayersBook( WORKERS_TRAINED, 0, GetWorldTotalMin( ), -(totalworkersadded * gGameExternalOptions.usWorkerTrainingCost) );
INT32 totalcost = totalworkersadded * gGameExternalOptions.usWorkerTrainingCost;
if ( totalcost > 0 )
AddTransactionToPlayersBook( WORKERS_TRAINED, 0, GetWorldTotalMin( ), -totalcost );
}
// Flugente: fortification
-1
View File
@@ -771,7 +771,6 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
void AddCreaturesToBattle_Other( UINT8 ubNum )
{
INT32 iRandom;
SOLDIERTYPE *pSoldier;
MAPEDGEPOINTINFO MapEdgepointInfo = {};
UINT8 bDesiredDirection = 0;
+21 -23
View File
@@ -876,9 +876,9 @@ UINT32 DrawMap( void )
if ( DoesSamCoverSector( i, SECTOR( cnt, cnt2 ), &samworking ) && samworking )
{
if ( i == 0 ) a = TRUE;
if ( i == 1 ) b = TRUE;
if ( i == 2 ) c = TRUE;
if ( i == 3 ) d = TRUE;
else if ( i == 1 ) b = TRUE;
else if ( i == 2 ) c = TRUE;
else if ( i == 3 ) d = TRUE;
}
}
@@ -1016,14 +1016,11 @@ UINT32 DrawMap( void )
DrawTownMilitiaForcesOnMap( );
}
if ( ( gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE || gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE_COLOURED_SAMS ) && !gfInChangeArrivalSectorMode )
if ( is_networked //haydent (allow client to see map deployment bullseye)
|| (( gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE || gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE_COLOURED_SAMS ) && !gfInChangeArrivalSectorMode ) )
{
DrawBullseye();
}
else if(is_networked)
{
DrawBullseye();//haydent (allow client to see map deployment bullseye)
}
}
else
{
@@ -5924,8 +5921,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
INT32 iCounter = 0, iNumberUnderControl = 0, iNumberOfGreens = 0, iNumberOfRegulars = 0, iNumberOfElites = 0, iTotalNumberOfTroops = 0;
INT32 iNumberLeftOverGreen = 0, iNumberLeftOverRegular = 0, iNumberLeftOverElite = 0;
INT16 sBaseSectorValue = 0, sCurrentSectorValue = 0;
INT16 sSectorX = 0, sSectorY = 0, sSector = 0;
INT16 sSectorX = 0, sSectorY = 0;
INT16 sTotalSoFar = 0;
UINT8 usSector = 0;
// how many sectors in the selected town do we control?
iNumberUnderControl = GetTownSectorsUnderControl( ( INT8 ) sSelectedMilitiaTown );
@@ -6007,17 +6005,17 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
if( !StrategicMap[ pTownLocationsList[ iCounter ] ].fEnemyControlled && !NumHostilesInSector( sSectorX, sSectorY, 0 ) )
{
sSector = SECTOR( sSectorX, sSectorY );
usSector = SECTOR( sSectorX, sSectorY );
// distribute here
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT8 )( iNumberOfGreens / iNumberUnderControl );
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT8 )( iNumberOfRegulars / iNumberUnderControl );
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT8 )( iNumberOfElites / iNumberUnderControl );
SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT8 )( iNumberOfGreens / iNumberUnderControl );
SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT8 )( iNumberOfRegulars / iNumberUnderControl );
SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT8 )( iNumberOfElites / iNumberUnderControl );
// Flugente: indivdual militia
DropIndividualMilitia( sSector, GREEN_MILITIA, (UINT8)(iNumberOfGreens / iNumberUnderControl) );
DropIndividualMilitia( sSector, REGULAR_MILITIA, (UINT8)(iNumberOfRegulars / iNumberUnderControl) );
DropIndividualMilitia( sSector, ELITE_MILITIA, (UINT8)(iNumberOfElites / iNumberUnderControl) );
DropIndividualMilitia( usSector, GREEN_MILITIA, (UINT8)(iNumberOfGreens / iNumberUnderControl) );
DropIndividualMilitia( usSector, REGULAR_MILITIA, (UINT8)(iNumberOfRegulars / iNumberUnderControl) );
DropIndividualMilitia( usSector, ELITE_MILITIA, (UINT8)(iNumberOfElites / iNumberUnderControl) );
// Flugente: as we do not move the group militia, we have to make sure we don't accidentally overfill a sector
sTotalSoFar = NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM );
@@ -6025,38 +6023,38 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
// add leftovers that weren't included in the div operation
if( ( iNumberLeftOverGreen ) && ( sTotalSoFar < iMaxMilitiaPerSector ) )
{
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]++;
SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]++;
++sTotalSoFar;
--iNumberLeftOverGreen;
// Flugente: indivdual militia
DropIndividualMilitia( sSector, GREEN_MILITIA, 1 );
DropIndividualMilitia( usSector, GREEN_MILITIA, 1 );
}
if( ( iNumberLeftOverRegular )&&( sTotalSoFar < iMaxMilitiaPerSector ) )
{
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]++;
SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]++;
++sTotalSoFar;
--iNumberLeftOverRegular;
// Flugente: indivdual militia
DropIndividualMilitia( sSector, REGULAR_MILITIA, 1 );
DropIndividualMilitia( usSector, REGULAR_MILITIA, 1 );
}
if( ( iNumberLeftOverElite )&&( sTotalSoFar < iMaxMilitiaPerSector ) )
{
SectorInfo[ sSector ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]++;
SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]++;
++sTotalSoFar;
--iNumberLeftOverElite;
// Flugente: indivdual militia
DropIndividualMilitia( sSector, ELITE_MILITIA, 1 );
DropIndividualMilitia( usSector, ELITE_MILITIA, 1 );
}
// if this sector is currently loaded
if( (gWorldSectorX != 0) &&
(gWorldSectorY != 0) &&
(sSector == SECTOR( gWorldSectorX, gWorldSectorY )) )
( usSector == SECTOR( gWorldSectorX, gWorldSectorY )) )
{
gfStrategicMilitiaChangesMade = TRUE;
}
+1 -1
View File
@@ -2079,7 +2079,7 @@ UINT32 CalcMilitiaUpkeep( void )
{
if ( militia_static[i] > militia_individual[i] )
{
uiTotalPayment += ( militia_static[i] + -militia_individual[i] ) * gGameExternalOptions.usDailyCostTown[i];
uiTotalPayment += ( militia_static[i] - militia_individual[i] ) * gGameExternalOptions.usDailyCostTown[i];
}
}
+1 -1
View File
@@ -4563,7 +4563,7 @@ void HandleFlashingItems( )
{
UINT32 cnt;
ITEM_POOL *pItemPool;
LEVELNODE *pObject;
//LEVELNODE *pObject;
ITEM_POOL_LOCATOR *pLocator;
BOOLEAN fDoLocator = FALSE;
+2 -2
View File
@@ -14198,13 +14198,13 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
{
SetFontForeground( a ? ITEMDESC_FONTPOSITIVE : ITEMDESC_FONTNEGATIVE );
swprintf( pStr, L"%s/%s", a ? "Y" : "N", b ? "Y" : "N" );
swprintf( pStr, L"%s/%s", a ? L"Y" : L"N", b ? L"Y" : L"N" );
}
else
{
SetFontForeground( 5 );
swprintf( pStr, L"%s", a ? "Y" : "N" );
swprintf( pStr, L"%s", a ? L"Y" : L"N" );
}
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY );
+1 -2
View File
@@ -10678,11 +10678,10 @@ void HandleTurncoatAttempt( SOLDIERTYPE* pSoldier )
// remember the target's ID
prisonerdialoguetargetID = pSoldier->ubID;
CHAR16 buf[256];
UINT8 ubCurrentProgress = CurrentPlayerProgressPercentage();
std::vector<std::pair<INT16, STR16> > dropdownvector_1;
int cnt = 1;
INT16 cnt = 1;
UINT8 chance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt );
swprintf( gTurncoatDropdownText[cnt-1], szTurncoatText[3], chance );
+10 -17
View File
@@ -19921,10 +19921,8 @@ FLOAT SOLDIERTYPE::GetConstructionPoints( )
UINT32 val = EffectiveStrength( this, FALSE );
ReducePointsForFatigue( this, &val );
FLOAT dval = val;
dval = dval * (100 + this->GetBackgroundValue( BG_FORTIFY_ASSIGNMENT )) / 100.0f;
FLOAT dval = val * (100 + this->GetBackgroundValue( BG_FORTIFY_ASSIGNMENT )) / 100.0f;
dval = (dval * this->stats.bLife / this->stats.bLifeMax);
@@ -19935,8 +19933,7 @@ FLOAT SOLDIERTYPE::GetConstructionPoints( )
BOOLEAN SOLDIERTYPE::HasItem(UINT16 usItem)
{
INT8 invsize = (INT8)inv.size( );
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
for ( size_t bLoop = 0, invsize = inv.size(); bLoop < invsize; ++bLoop )
{
if ( inv[bLoop].exists( ) == true && inv[bLoop].usItem == usItem )
return TRUE;
@@ -19951,8 +19948,7 @@ BOOLEAN SOLDIERTYPE::SelfDetonate( )
if ( !(this->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) )
return FALSE;
INT8 invsize = (INT8)inv.size( );
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
for ( size_t bLoop = 0, invsize = inv.size(); bLoop < invsize; ++bLoop )
{
if ( inv[bLoop].exists( ) == true && inv[bLoop].usItem == this->aiData.usActionData )
{
@@ -19980,8 +19976,7 @@ UINT8 SOLDIERTYPE::GetWaterSnakeDefenseChance()
val += this->GetBackgroundValue( BG_SNAKEDEFENSE );
// bonus if we have a knife, extra if it is in our hands
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
for ( size_t bLoop = 0, invsize = inv.size(); bLoop < invsize; ++bLoop )
{
if ( inv[bLoop].exists( ) )
{
@@ -20026,9 +20021,7 @@ UINT16 SOLDIERTYPE::GetInteractiveActionSkill( INT32 sGridNo, UINT8 usLevel, UIN
OBJECTTYPE* pObj = NULL;
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
for ( size_t bLoop = 0, invsize = inv.size(); bLoop < invsize; ++bLoop )
{
if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].usHackingModifier )
{
@@ -20191,7 +20184,7 @@ BOOLEAN SOLDIERTYPE::CanDragInPrinciple()
return TRUE;
}
BOOLEAN SOLDIERTYPE::CanDragPerson( UINT8 usID )
BOOLEAN SOLDIERTYPE::CanDragPerson( UINT16 usID )
{
if ( !CanDragInPrinciple() )
return FALSE;
@@ -20288,7 +20281,7 @@ void SOLDIERTYPE::SetDragOrderPerson( UINT16 usID )
{
// sevenfm: if someone is dragging this soldier, cancel drag
SOLDIERTYPE *pSoldier;
for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop)
{
pSoldier = MercPtrs[uiLoop];
if (pSoldier && pSoldier->usDragPersonID == usID)
@@ -20813,7 +20806,7 @@ BOOLEAN SOLDIERTYPE::InPositionForTurncoatAttempt( UINT16 usID )
return FALSE;
}
UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( UINT16 usID, UINT8 usApproach )
UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( UINT16 usID, INT16 sApproach )
{
if ( usID >= NOBODY )
return 0;
@@ -20875,7 +20868,7 @@ UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( UINT16 usID, UINT8 usApproach
ReducePointsForFatigue( pSoldier, &enemyresistancerating );
switch ( usApproach )
switch ( sApproach )
{
// base approach
case 1:
+2 -2
View File
@@ -2004,7 +2004,7 @@ public:
// Flugente: drag people
BOOLEAN CanDragInPrinciple();
BOOLEAN CanDragPerson( UINT8 usID );
BOOLEAN CanDragPerson( UINT16 usID );
BOOLEAN CanDragCorpse( UINT16 usCorpseNum );
BOOLEAN IsDraggingSomeone();
void SetDragOrderPerson( UINT16 usID );
@@ -2034,7 +2034,7 @@ public:
// Flugente: turncoats
BOOLEAN InPositionForTurncoatAttempt( UINT16 usID );
UINT8 GetTurncoatConvinctionChance( UINT16 usID, UINT8 usApproach );
UINT8 GetTurncoatConvinctionChance( UINT16 usID, INT16 usApproach );
void AttemptToCreateTurncoat( UINT16 usID );
BOOLEAN OrderTurnCoatToSwitchSides( UINT16 usID );
void OrderAllTurnCoatToSwitchSides();
-1
View File
@@ -2074,7 +2074,6 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum
void AddSoldierInitListOtherCreatures( UINT8 usNum )
{
SOLDIERINITNODE *curr;
INT32 iRandom;
UINT8 ubFreeSlots;
BOOLEAN fDoPlacement;
UINT8 ubNumCreatures = usNum;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef __SCREEN_IDS
#define __SCREEN_IDS
typedef enum ScreenTypes
enum ScreenTypes
{
EDIT_SCREEN,
SAVING_SCREEN,