adjust to different scoping of variables declared in for loops

This commit is contained in:
Jonathan Gray 2013-04-21 20:29:47 +10:00
parent ea4f7f0599
commit 666685fba6
18 changed files with 61 additions and 32 deletions

View file

@ -1391,7 +1391,8 @@ void CGCam_UpdateShake( vec3_t origin, vec3_t angles )
intensity = client_camera.shake_intensity * intensity_scale; intensity = client_camera.shake_intensity * intensity_scale;
for ( int i = 0; i < 3; i++ ) int i;
for ( i = 0; i < 3; i++ )
{ {
moveDir[i] = ( crandom() * intensity ); moveDir[i] = ( crandom() * intensity );
} }

View file

@ -4534,7 +4534,8 @@ void S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bCall
{ {
extern const char *Music_GetLevelSetName(void); extern const char *Music_GetLevelSetName(void);
Q_strncpyz(sInfoOnly_CurrentDynamicMusicSet, Music_GetLevelSetName(), sizeof(sInfoOnly_CurrentDynamicMusicSet)); Q_strncpyz(sInfoOnly_CurrentDynamicMusicSet, Music_GetLevelSetName(), sizeof(sInfoOnly_CurrentDynamicMusicSet));
for (int i = eBGRNDTRACK_DATABEGIN; i != eBGRNDTRACK_DATAEND; i++) int i;
for (i = eBGRNDTRACK_DATABEGIN; i != eBGRNDTRACK_DATAEND; i++)
{ {
qboolean bOk = qfalse; qboolean bOk = qfalse;
LPCSTR psMusicName = Music_GetFileNameForState( (MusicState_e) i); LPCSTR psMusicName = Music_GetFileNameForState( (MusicState_e) i);
@ -5163,7 +5164,8 @@ int SND_FreeOldestSound(sfx_t *pButNotThisOne /* = NULL */)
{ {
// new bit, we can't throw away any sfx_t struct in use by a channel, else the paint code will crash... // new bit, we can't throw away any sfx_t struct in use by a channel, else the paint code will crash...
// //
for (int iChannel=0; iChannel<MAX_CHANNELS; iChannel++) int iChannel;
for (iChannel=0; iChannel<MAX_CHANNELS; iChannel++)
{ {
channel_t *ch = & s_channels[iChannel]; channel_t *ch = & s_channels[iChannel];

View file

@ -199,7 +199,8 @@ qboolean AI_FindSelfInPreviousGroup( gentity_t *self )
void AI_InsertGroupMember( AIGroupInfo_t *group, gentity_t *member ) void AI_InsertGroupMember( AIGroupInfo_t *group, gentity_t *member )
{ {
//okay, you know what? Check this damn group and make sure we're not already in here! //okay, you know what? Check this damn group and make sure we're not already in here!
for ( int i = 0; i < group->numGroup; i++ ) int i;
for ( i = 0; i < group->numGroup; i++ )
{ {
if ( group->member[i].number == member->s.number ) if ( group->member[i].number == member->s.number )
{//already in here {//already in here

View file

@ -1403,7 +1403,8 @@ bool NPC_SafeSpawn( gentity_t *ent, float safeRadius )
} }
//Setup the bbox to search in //Setup the bbox to search in
for ( int i = 0; i < 3; i++ ) int i;
for ( i = 0; i < 3; i++ )
{ {
safeMins[i] = ent->currentOrigin[i] - safeRadius; safeMins[i] = ent->currentOrigin[i] - safeRadius;
safeMaxs[i] = ent->currentOrigin[i] + safeRadius; safeMaxs[i] = ent->currentOrigin[i] + safeRadius;

View file

@ -1099,7 +1099,8 @@ int NPC_FindNearestEnemy( gentity_t *ent )
int numEnts, numChecks = 0; int numEnts, numChecks = 0;
//Setup the bbox to search in //Setup the bbox to search in
for ( int i = 0; i < 3; i++ ) int i;
for ( i = 0; i < 3; i++ )
{ {
mins[i] = ent->currentOrigin[i] - NPCInfo->stats.visrange; mins[i] = ent->currentOrigin[i] - NPCInfo->stats.visrange;
maxs[i] = ent->currentOrigin[i] + NPCInfo->stats.visrange; maxs[i] = ent->currentOrigin[i] + NPCInfo->stats.visrange;

View file

@ -639,7 +639,8 @@ void Player_CacheFromPrevLevel(void)
&ibits //client->ps.stats[STAT_ITEMS] &ibits //client->ps.stats[STAT_ITEMS]
); );
for ( int i = 1 ; i < 16 ; i++ ) int i;
for ( i = 1 ; i < 16 ; i++ )
{ {
if ( bits & ( 1 << i ) ) if ( bits & ( 1 << i ) )
{ {

View file

@ -480,7 +480,8 @@ void G_AlertTeam( gentity_t *victim, gentity_t *attacker, float radius, float so
return; return;
//Setup the bbox to search in //Setup the bbox to search in
for ( int i = 0; i < 3; i++ ) int i;
for ( i = 0; i < 3; i++ )
{ {
mins[i] = victim->currentOrigin[i] - radius; mins[i] = victim->currentOrigin[i] - radius;
maxs[i] = victim->currentOrigin[i] + radius; maxs[i] = victim->currentOrigin[i] + radius;

View file

@ -298,7 +298,8 @@ static qboolean G_InitRoff( char *file, unsigned char *data )
move_rotate_t *roff_data = ( move_rotate_t *)&header[1]; move_rotate_t *roff_data = ( move_rotate_t *)&header[1];
// Copy all of the goods into our ROFF cache // Copy all of the goods into our ROFF cache
for ( int i = 0; i < count; i++, roff_data++, mem++ ) int i;
for ( i = 0; i < count; i++, roff_data++, mem++ )
{ {
// Copy just the delta position and orientation which can be applied to anything at a later point // Copy just the delta position and orientation which can be applied to anything at a later point
VectorCopy( roff_data->origin_delta, mem->origin_delta ); VectorCopy( roff_data->origin_delta, mem->origin_delta );
@ -335,7 +336,8 @@ static qboolean G_InitRoff( char *file, unsigned char *data )
roffs[num_roffs].type = 2; //rww - any reason this wasn't being set already? roffs[num_roffs].type = 2; //rww - any reason this wasn't being set already?
// Copy all of the goods into our ROFF cache // Copy all of the goods into our ROFF cache
for ( int i = 0; i < count; i++ ) int i;
for ( i = 0; i < count; i++ )
{ {
VectorCopy( roff_data[i].origin_delta, mem[i].origin_delta ); VectorCopy( roff_data[i].origin_delta, mem[i].origin_delta );
VectorCopy( roff_data[i].rotate_delta, mem[i].rotate_delta ); VectorCopy( roff_data[i].rotate_delta, mem[i].rotate_delta );

View file

@ -793,7 +793,8 @@ static void WriteGEntities(qboolean qbAutosave)
{ {
int iCount = 0; int iCount = 0;
for (int i=0; i<(qbAutosave?1:globals.num_entities); i++) int i;
for (i=0; i<(qbAutosave?1:globals.num_entities); i++)
{ {
gentity_t* ent = &g_entities[i]; gentity_t* ent = &g_entities[i];
@ -886,7 +887,8 @@ static void ReadGEntities(qboolean qbAutosave)
gi.ReadFromSaveGame('NMED', (void *)&iCount, sizeof(iCount)); gi.ReadFromSaveGame('NMED', (void *)&iCount, sizeof(iCount));
int iPreviousEntRead = -1; int iPreviousEntRead = -1;
for (int i=0; i<iCount; i++) int i;
for (i=0; i<iCount; i++)
{ {
int iEntIndex; int iEntIndex;
gi.ReadFromSaveGame('EDNM', (void *)&iEntIndex, sizeof(iEntIndex)); gi.ReadFromSaveGame('EDNM', (void *)&iEntIndex, sizeof(iEntIndex));
@ -1353,4 +1355,4 @@ struct Vehicle_t
float m_safeJumpMountRightDot; float m_safeJumpMountRightDot;
}; };
#endif #endif

View file

@ -1752,7 +1752,8 @@ void WP_SaberDamageAdd( float trDmg, int trVictimEntityNum, vec3_t trDmgDir, vec
} }
if ( trDmg ) if ( trDmg )
{//did some damage to something {//did some damage to something
for ( int i = 0; i < numVictims; i++ ) int i;
for ( i = 0; i < numVictims; i++ )
{ {
if ( victimEntityNum[i] == trVictimEntityNum ) if ( victimEntityNum[i] == trVictimEntityNum )
{//already hit this guy before {//already hit this guy before
@ -8345,7 +8346,8 @@ qboolean G_CheckEnemyPresence( gentity_t *ent, int dir, float radius, float tole
//Get all ents in range, see if they're living clients and enemies, then check dot to them... //Get all ents in range, see if they're living clients and enemies, then check dot to them...
//Setup the bbox to search in //Setup the bbox to search in
for ( int i = 0; i < 3; i++ ) int i;
for ( i = 0; i < 3; i++ )
{ {
mins[i] = ent->currentOrigin[i] - radius; mins[i] = ent->currentOrigin[i] - radius;
maxs[i] = ent->currentOrigin[i] + radius; maxs[i] = ent->currentOrigin[i] + radius;
@ -14568,4 +14570,4 @@ void WP_InitForcePowers( gentity_t *ent )
ent->client->ps.forcePowerLevel[FP_GRIP] = FORCE_LEVEL_2; ent->client->ps.forcePowerLevel[FP_GRIP] = FORCE_LEVEL_2;
} }
} }
} }

View file

@ -18,7 +18,8 @@ char SaberParms[MAX_SABER_DATA_SIZE];
void Saber_SithSwordPrecache( void ) void Saber_SithSwordPrecache( void )
{//*SIGH* special sounds used by the sith sword {//*SIGH* special sounds used by the sith sword
for ( int i = 1; i < 5; i++ ) int i;
for ( i = 1; i < 5; i++ )
{ {
G_SoundIndex( va( "sound/weapons/sword/stab%d.wav", i ) ); G_SoundIndex( va( "sound/weapons/sword/stab%d.wav", i ) );
} }

View file

@ -1119,7 +1119,8 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_
// did we hit it? // did we hit it?
if (G2_SegmentTriangleTest(TS.rayStart, TS.rayEnd, point1, point2, point3, qtrue, qtrue, hitPoint, normal, &face)) if (G2_SegmentTriangleTest(TS.rayStart, TS.rayEnd, point1, point2, point3, qtrue, qtrue, hitPoint, normal, &face))
{ // find space in the collision records for this record { // find space in the collision records for this record
for (int i=0; i<MAX_G2_COLLISIONS;i++) int i;
for (i=0; i<MAX_G2_COLLISIONS;i++)
{ {
if (TS.collRecMap[i].mEntityNum == -1) if (TS.collRecMap[i].mEntityNum == -1)
{ {
@ -1351,7 +1352,8 @@ static bool G2_RadiusTracePolys(
{ {
// we hit a triangle, so init a collision record... // we hit a triangle, so init a collision record...
// //
for (int i=0; i<MAX_G2_COLLISIONS;i++) int i;
for (i=0; i<MAX_G2_COLLISIONS;i++)
{ {
if (TS.collRecMap[i].mEntityNum == -1) if (TS.collRecMap[i].mEntityNum == -1)
{ {
@ -1767,7 +1769,8 @@ void G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2)
// add in count for number of ghoul2 models // add in count for number of ghoul2 models
iGhoul2Size += 4; iGhoul2Size += 4;
// start out working out the total size of the buffer we need to allocate // start out working out the total size of the buffer we need to allocate
for (int i=0; i<ghoul2.size();i++) int i;
for (i=0; i<ghoul2.size();i++)
{ {
iGhoul2Size += ghoul2BlockSize; iGhoul2Size += ghoul2BlockSize;
// add in count for number of surfaces // add in count for number of surfaces
@ -1803,7 +1806,8 @@ void G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2)
tempBuffer +=4; tempBuffer +=4;
// now save the all the surface list info // now save the all the surface list info
for (int x=0; x<ghoul2[i].mSlist.size(); x++) int x;
for (x=0; x<ghoul2[i].mSlist.size(); x++)
{ {
memcpy(tempBuffer, &ghoul2[i].mSlist[x], SURFACE_SAVE_BLOCK_SIZE); memcpy(tempBuffer, &ghoul2[i].mSlist[x], SURFACE_SAVE_BLOCK_SIZE);
tempBuffer += SURFACE_SAVE_BLOCK_SIZE; tempBuffer += SURFACE_SAVE_BLOCK_SIZE;
@ -1840,7 +1844,8 @@ int G2_FindConfigStringSpace(char *name, int start, int max)
{ {
char s[MAX_STRING_CHARS]; char s[MAX_STRING_CHARS];
for (int i=1 ; i<max ; i++ ) int i;
for ( i=1 ; i<max ; i++ )
{ {
SV_GetConfigstring( start + i, s, sizeof( s ) ); SV_GetConfigstring( start + i, s, sizeof( s ) );
if ( !s[0] ) if ( !s[0] )
@ -1896,7 +1901,8 @@ void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
buffer +=4; buffer +=4;
// now load all the surfaces // now load all the surfaces
for (int x=0; x<ghoul2[i].mSlist.size(); x++) int x;
for (x=0; x<ghoul2[i].mSlist.size(); x++)
{ {
memcpy(&ghoul2[i].mSlist[x], buffer, SURFACE_SAVE_BLOCK_SIZE); memcpy(&ghoul2[i].mSlist[x], buffer, SURFACE_SAVE_BLOCK_SIZE);
buffer += SURFACE_SAVE_BLOCK_SIZE; buffer += SURFACE_SAVE_BLOCK_SIZE;

View file

@ -631,7 +631,8 @@ int CSequence::Load( CIcarus* icarus )
icarus->BufferRead( &iNumChildren, sizeof( iNumChildren ) ); icarus->BufferRead( &iNumChildren, sizeof( iNumChildren ) );
//Reload all children //Reload all children
for ( int i = 0; i < iNumChildren; i++ ) int i;
for ( i = 0; i < iNumChildren; i++ )
{ {
//Get the child sequence ID //Get the child sequence ID
icarus->BufferRead( &id, sizeof( id ) ); icarus->BufferRead( &id, sizeof( id ) );
@ -671,4 +672,4 @@ int CSequence::Load( CIcarus* icarus )
} }
return true; return true;
} }

View file

@ -2553,7 +2553,8 @@ int CSequencer::Load( CIcarus* icarus, IGameInterface* game )
pIcarus->BufferRead( &numSequences, sizeof( numSequences ) ); pIcarus->BufferRead( &numSequences, sizeof( numSequences ) );
//Read in all the sequences //Read in all the sequences
for ( int i = 0; i < numSequences; i++ ) int i;
for ( i = 0; i < numSequences; i++ )
{ {
pIcarus->BufferRead( &seqID, sizeof( seqID ) ); pIcarus->BufferRead( &seqID, sizeof( seqID ) );

View file

@ -1849,7 +1849,8 @@ void CTaskManager::Load( CIcarus* icarus )
pIcarus->BufferRead( &numTasks, sizeof( numTasks ) ); pIcarus->BufferRead( &numTasks, sizeof( numTasks ) );
//Reload all the tasks //Reload all the tasks
for ( int i = 0; i < numTasks; i++ ) int i;
for ( i = 0; i < numTasks; i++ )
{ {
task = new CTask; task = new CTask;

View file

@ -893,7 +893,8 @@ qboolean RE_InitDissolve(qboolean bForceCircularExtroWipe)
// //
// do it... // do it...
// //
for (int y = 0; y < glConfig.vidHeight; y++) int y;
for (y = 0; y < glConfig.vidHeight; y++)
{ {
pbDst -= iClearBytes; pbDst -= iClearBytes;
memset(pbDst,0,iClearBytes); memset(pbDst,0,iClearBytes);

View file

@ -592,7 +592,8 @@ static int Thai_ValidTISCode( const byte *psString, int &iThaiBytes )
// thai codes can be up to 3 bytes long, so see how high we can get... // thai codes can be up to 3 bytes long, so see how high we can get...
// //
for (int i=0; i<3; i++) int i;
for (i=0; i<3; i++)
{ {
CodeToTry.sChars[i] = psString[i]; CodeToTry.sChars[i] = psString[i];
@ -1671,9 +1672,11 @@ void R_ReloadFonts_f(void)
// //
vector <sstring_t> vstrFonts; vector <sstring_t> vstrFonts;
for (int iFontToFind = 1; iFontToFind < g_iCurrentFontIndex; iFontToFind++) int iFontToFind;
for (iFontToFind = 1; iFontToFind < g_iCurrentFontIndex; iFontToFind++)
{ {
for (FontIndexMap_t::iterator it = g_mapFontIndexes.begin(); it != g_mapFontIndexes.end(); ++it) FontIndexMap_t::iterator it;
for (it = g_mapFontIndexes.begin(); it != g_mapFontIndexes.end(); ++it)
{ {
if (iFontToFind == (*it).second) if (iFontToFind == (*it).second)
{ {

View file

@ -888,7 +888,8 @@ void SG_ReadServerConfigStrings( void )
{ {
// trash the whole table... // trash the whole table...
// //
for (int i=0; i<MAX_CONFIGSTRINGS; i++) int i;
for (i=0; i<MAX_CONFIGSTRINGS; i++)
{ {
if (i!=CS_SYSTEMINFO) if (i!=CS_SYSTEMINFO)
{ {