cleaned up code: various stuff (out-of-bounds, null-pointer, uninitialized vars,...) (by CleaningWoman)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6101 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-05-27 20:38:52 +00:00
parent 921394b24c
commit f92f70c78d
39 changed files with 167 additions and 149 deletions
+1 -1
View File
@@ -1345,7 +1345,7 @@ void CreatureAttackCallback( GUI_BUTTON *btn, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if( ( gsSelSectorX != 0 ) && ( gsSelSectorX != 0 ) )
if( ( gsSelSectorX != 0 ) && ( gsSelSectorY != 0 ) )
{
if( _KeyDown( ALT ) )
{
+2 -2
View File
@@ -15279,7 +15279,7 @@ BOOLEAN DisplayFacilityAssignmentMenu( SOLDIERTYPE *pSoldier, UINT8 ubFacilityTy
}
}
}
if (fFoundVehicle = FALSE)
if (fFoundVehicle == FALSE)
{
// Create line that says "Repair Vehicle", and will be shaded.
swprintf( sTempString, gzFacilityAssignmentStrings[ FAC_REPAIR_VEHICLE ], L"Vehicle" );
@@ -16922,7 +16922,7 @@ void HandleShadingOfLinesForFacilityAssignmentMenu( void )
fFoundVehicle = TRUE;
}
}
if (fFoundVehicle = FALSE)
if (fFoundVehicle == FALSE)
{
// The line here says "Repair Vehicle", and is shaded because there's no vehicle present.
UnSecondaryShadeStringInBox( ghFacilityAssignmentBox, iNumLine );
+1
View File
@@ -3061,6 +3061,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason )
}
}
Assert(pCell);
if( pCell->uiFlags & ( CELL_RETREATING | CELL_RETREATED ) )
{ //already retreated/retreating.
return;
+2 -2
View File
@@ -784,9 +784,9 @@ ACTION_ITEM_VALUES ActionItemsValues[500];
void IniLuaGlobal()
{
UINT32 i;
UINT32 i;
for (i= 0; i<=1000; i++ )
for (i= 0; i<1000; i++ )
{
gLuaGlobal[i].fGlobalLuaBool = FALSE;
gLuaGlobal[i].iGlobalLuaVal = 0;
@@ -4257,8 +4257,8 @@ void SortSectorInventoryAmmo(bool useBoxes)
{
// Declarations
INT32 crateItem;
bool mergeSuccessful, ammoPresent;
INT32 crateItem;
bool mergeSuccessful = false;
OBJECTTYPE newCrate;
int loopCount = 0;
@@ -4267,7 +4267,7 @@ void SortSectorInventoryAmmo(bool useBoxes)
AssertMsg( pSoldier != NULL, "Sector Inventory: Attempting ammo sort without valid selected soldier?" );
//MM: added for ammo boxes
ammoPresent = true;
bool ammoPresent = true;
UINT8 magType = AMMO_CRATE;
if (useBoxes)
magType = AMMO_BOX;
+3 -3
View File
@@ -1236,7 +1236,7 @@ char temp;
else
{
strncpy(pData->curCityInfo.IconSTI,pData->szCharData,MAX_ICON_CHARS);
pData->curCityInfo.IconSTI[MAX_ICON_CHARS] = '\0';
pData->curCityInfo.IconSTI[MAX_ICON_CHARS-1] = '\0';
}
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ICON_CHARS);i++)
@@ -4209,7 +4209,7 @@ void AllMercsWalkedToExitGrid()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - reset num enemies here if the sector was unloaded
if( gWorldSectorX == 0 && gWorldSectorX == 0 && gbWorldSectorZ == -1 )
if( gWorldSectorX == 0 && gWorldSectorY == 0 && gbWorldSectorZ == -1 )
{
memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS );
}
@@ -4396,7 +4396,7 @@ void AllMercsHaveWalkedOffSector( )
SetDefaultSquadOnSectorEntry( TRUE );
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - reset num enemies here if the sector was unloaded
if( !fEnemiesInLoadedSector || (gWorldSectorX == 0 && gWorldSectorX == 0 && gbWorldSectorZ == -1 ) )
if( !fEnemiesInLoadedSector || (gWorldSectorX == 0 && gWorldSectorY == 0 && gbWorldSectorZ == -1 ) )
{
memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS );
}