adjust to different scoping of variables declared in for loops

This commit is contained in:
Jonathan Gray 2013-04-23 10:11:19 +10:00
parent a06907e8f5
commit b1875def86
17 changed files with 58 additions and 30 deletions

View File

@ -1248,7 +1248,8 @@ void CGCam_UpdateShake( vec3_t origin, vec3_t angles )
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 );
}

View File

@ -1152,7 +1152,8 @@ void CG_AddViewWeapon( playerState_t *ps )
}
*/
// add the spinning barrel[s]
for (int i = 0; (i < wData->numBarrels); i++)
int i;
for (i = 0; (i < wData->numBarrels); i++)
{
refEntity_t barrel;
memset( &barrel, 0, sizeof( barrel ) );

View File

@ -4316,7 +4316,8 @@ void S_StartBackgroundTrack( const char *intro, const char *loop, qboolean bCall
{
extern const char *Music_GetLevelSetName(void);
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;
LPCSTR psMusicName = Music_GetFileNameForState( (MusicState_e) i);
@ -4948,7 +4949,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...
//
for (int iChannel=0; iChannel<MAX_CHANNELS; iChannel++)
int iChannel;
for (iChannel=0; iChannel<MAX_CHANNELS; iChannel++)
{
channel_t *ch = & s_channels[iChannel];

View File

@ -231,7 +231,8 @@ qboolean AI_FindSelfInPreviousGroup( gentity_t *self )
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!
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 )
{//already in here

View File

@ -1030,7 +1030,8 @@ int NPC_FindNearestEnemy( gentity_t *ent )
int numEnts, numChecks = 0;
//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;
maxs[i] = ent->currentOrigin[i] + NPCInfo->stats.visrange;

View File

@ -620,7 +620,8 @@ void Player_CacheFromPrevLevel(void)
&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 ) )
{

View File

@ -412,7 +412,8 @@ void G_AlertTeam( gentity_t *victim, gentity_t *attacker, float radius, float so
return;
//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;
maxs[i] = victim->currentOrigin[i] + radius;

View File

@ -348,7 +348,8 @@ int CNode::Save( int numNodes, fileHandle_t file )
gi.FS_Write( &header, sizeof( header ), file );
//Write out the basic information
for ( int i = 0; i < 3; i++ )
int i;
for ( i = 0; i < 3; i++ )
gi.FS_Write( &m_position[i], sizeof( float ), file );
gi.FS_Write( &m_flags, sizeof( m_flags ), file );
@ -391,7 +392,8 @@ int CNode::Load( int numNodes, fileHandle_t file )
return false;
//Get the basic information
for ( int i = 0; i < 3; i++ )
int i;
for ( i = 0; i < 3; i++ )
gi.FS_Read( &m_position[i], sizeof( float ), file );
gi.FS_Read( &m_flags, sizeof( m_flags ), file );
@ -777,7 +779,8 @@ void CNavigator::CalculatePath( CNode *node )
node->AddRank( node->GetID(), curRank++ );
//Add all initial nodes
for ( int i = 0; i < node->GetNumEdges(); i++ )
int i;
for ( i = 0; i < node->GetNumEdges(); i++ )
{
CNode *nextNode = m_nodes[ node->GetEdge(i) ];
assert(nextNode);
@ -840,7 +843,8 @@ void CNavigator::CalculatePaths( bool recalc )
#else
#endif
for ( int i = 0; i < m_nodes.size(); i++ )
int i;
for ( i = 0; i < m_nodes.size(); i++ )
{
//Allocate the needed memory
m_nodes[i]->InitRanks( m_nodes.size() );

View File

@ -320,7 +320,8 @@ qboolean G_InitRoff( char *file, unsigned char *data )
roffs[num_roffs].type = 2; //rww - any reason this wasn't being set already?
// 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].rotate_delta, mem[i].rotate_delta );

View File

@ -627,7 +627,8 @@ void WriteGEntities(qboolean qbAutosave)
{
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];
@ -721,7 +722,8 @@ void ReadGEntities(qboolean qbAutosave)
gi.ReadFromSaveGame('NMED', (void *)&iCount, sizeof(iCount));
int iPreviousEntRead = -1;
for (int i=0; i<iCount; i++)
int i;
for (i=0; i<iCount; i++)
{
int iEntIndex;
gi.ReadFromSaveGame('EDNM', (void *)&iEntIndex, sizeof(iEntIndex));

View File

@ -950,7 +950,8 @@ void WP_SaberDamageAdd( float trDmg, int trVictimEntityNum, vec3_t trDmgDir, vec
}
if ( trDmg )
{//did some damage to something
for ( int i = 0; i < numVictims; i++ )
int i;
for ( i = 0; i < numVictims; i++ )
{
if ( victimEntityNum[i] == trVictimEntityNum )
{//already hit this guy before

View File

@ -552,7 +552,8 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_
// did we hit it?
if (G2_SegmentTriangleTest(TS.rayStart, TS.rayEnd, point1, point2, point3, qtrue, qtrue, hitPoint, normal, &face))
{ // 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)
{
@ -798,7 +799,8 @@ static bool G2_RadiusTracePolys(
{
// 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)
{
@ -1129,7 +1131,8 @@ qboolean G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size)
// add in count for number of ghoul2 models
*size += 4;
// 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++)
{
*size += ghoul2BlockSize;
// add in count for number of surfaces
@ -1165,7 +1168,8 @@ qboolean G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size)
tempBuffer +=4;
// 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);
tempBuffer += SURFACE_SAVE_BLOCK_SIZE;
@ -1207,7 +1211,8 @@ int G2_FindConfigStringSpace(char *name, int start, int max)
{
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 ) );
if ( !s[0] )
@ -1263,7 +1268,8 @@ void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
buffer +=4;
// 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);
buffer += SURFACE_SAVE_BLOCK_SIZE;

View File

@ -429,7 +429,8 @@ int CSequence::Load( void )
(m_owner->GetInterface())->I_ReadSaveData( 'SNCH', &m_numChildren, sizeof( m_numChildren ) );
//Reload all children
for ( int i = 0; i < m_numChildren; i++ )
int i;
for ( i = 0; i < m_numChildren; i++ )
{
//Get the child sequence ID
(m_owner->GetInterface())->I_ReadSaveData( 'SCHD', &id, sizeof( id ) );

View File

@ -2400,7 +2400,8 @@ int CSequencer::Load( void )
m_ie->I_ReadSaveData( 'SQR#', &numSequences, sizeof( numSequences ) );
//Read in all the sequences
for ( int i = 0; i < numSequences; i++ )
int i;
for ( i = 0; i < numSequences; i++ )
{
m_ie->I_ReadSaveData( 'SQRI', &seqID, sizeof( seqID ) );

View File

@ -1800,7 +1800,8 @@ void CTaskManager::Load( void )
(m_owner->GetInterface())->I_ReadSaveData( 'TSK#', &numTasks, sizeof( numTasks ) );
//Reload all the tasks
for ( int i = 0; i < numTasks; i++ )
int i;
for ( i = 0; i < numTasks; i++ )
{
task = new CTask;

View File

@ -815,7 +815,8 @@ qboolean RE_InitDissolve(qboolean bForceCircularExtroWipe)
//
// do it...
//
for (int y = 0; y < glConfig.vidHeight; y++)
int y;
for (y = 0; y < glConfig.vidHeight; y++)
{
pbDst -= iClearBytes;
memset(pbDst,0,iClearBytes);
@ -845,7 +846,8 @@ qboolean RE_InitDissolve(qboolean bForceCircularExtroWipe)
// Now, in case of busted drivers, 3DFX cards, etc etc we stomp the alphas to 255...
//
byte *pPix = pBuffer;
for (int i=0; i<iBufferBytes/4; i++, pPix += 4)
int i;
for (i=0; i<iBufferBytes/4; i++, pPix += 4)
{
pPix[3] = 255;
}

View File

@ -661,7 +661,8 @@ void SG_ReadServerConfigStrings( void )
{
// 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)
{