Fix variable names manually

This commit is contained in:
def 2020-10-26 15:14:07 +01:00
parent b1f0fd8969
commit 165857a5a8
53 changed files with 485 additions and 488 deletions

View file

@ -1826,12 +1826,12 @@ void CCommandProcessorFragment_OpenGL2::Cmd_DeleteBufferContainer(const CCommand
int VertBufferID = BufferContainer.m_ContainerInfo.m_Attributes[i].m_VertBufferBindingIndex;
if(VertBufferID != -1)
{
for(auto &m_Attribute : BufferContainer.m_ContainerInfo.m_Attributes)
for(auto &Attribute : BufferContainer.m_ContainerInfo.m_Attributes)
{
// set all equal ids to zero to not double delete
if(VertBufferID == m_Attribute.m_VertBufferBindingIndex)
if(VertBufferID == Attribute.m_VertBufferBindingIndex)
{
m_Attribute.m_VertBufferBindingIndex = -1;
Attribute.m_VertBufferBindingIndex = -1;
}
}
@ -3096,12 +3096,12 @@ void CCommandProcessorFragment_OpenGL3_3::DestroyBufferContainer(int Index, bool
int VertBufferID = BufferContainer.m_ContainerInfo.m_Attributes[i].m_VertBufferBindingIndex;
if(VertBufferID != -1)
{
for(auto &m_Attribute : BufferContainer.m_ContainerInfo.m_Attributes)
for(auto &Attribute : BufferContainer.m_ContainerInfo.m_Attributes)
{
// set all equal ids to zero to not double delete
if(VertBufferID == m_Attribute.m_VertBufferBindingIndex)
if(VertBufferID == Attribute.m_VertBufferBindingIndex)
{
m_Attribute.m_VertBufferBindingIndex = -1;
Attribute.m_VertBufferBindingIndex = -1;
}
}
@ -3148,9 +3148,9 @@ void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesC
for(unsigned int &i : m_LastIndexBufferBound)
i = 0;
for(auto &m_BufferContainer : m_BufferContainers)
for(auto &BufferContainer : m_BufferContainers)
{
m_BufferContainer.m_LastIndexBufferBound = 0;
BufferContainer.m_LastIndexBufferBound = 0;
}
m_CurrentIndicesInBuffer = NewIndicesCount;

View file

@ -263,8 +263,8 @@ void CSmoothTime::Update(CGraph *pGraph, int64 Target, int TimeLeft, int AdjustD
CClient::CClient() :
m_DemoPlayer(&m_SnapshotDelta)
{
for(auto &i : m_DemoRecorder)
i = CDemoRecorder(&m_SnapshotDelta);
for(auto &DemoRecorder : m_DemoRecorder)
DemoRecorder = CDemoRecorder(&m_SnapshotDelta);
m_pEditor = 0;
m_pInput = 0;
@ -2019,12 +2019,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
SnapshotRemoveExtraInfo(aExtraInfoRemoved);
// add snapshot to demo
for(auto &i : m_DemoRecorder)
for(auto &DemoRecorder : m_DemoRecorder)
{
if(i.IsRecording())
if(DemoRecorder.IsRecording())
{
// write snapshot
i.RecordSnapshot(GameTick, aExtraInfoRemoved, SnapSize);
DemoRecorder.RecordSnapshot(GameTick, aExtraInfoRemoved, SnapSize);
}
}
@ -2091,9 +2091,9 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
if((pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 || Msg == NETMSGTYPE_SV_EXTRAPROJECTILE)
{
// game message
for(auto &i : m_DemoRecorder)
if(i.IsRecording())
i.RecordMessage(pPacket->m_pData, pPacket->m_DataSize);
for(auto &DemoRecorder : m_DemoRecorder)
if(DemoRecorder.IsRecording())
DemoRecorder.RecordMessage(pPacket->m_pData, pPacket->m_DataSize);
GameClient()->OnMessage(Msg, &Unpacker);
}
@ -2530,9 +2530,9 @@ void CClient::LoadDDNetInfo()
void CClient::PumpNetwork()
{
for(auto &i : m_NetClient)
for(auto &NetClient : m_NetClient)
{
i.Update();
NetClient.Update();
}
if(State() != IClient::STATE_DEMOPLAYBACK)
@ -3056,12 +3056,12 @@ void CClient::Run()
mem_zero(&BindAddr, sizeof(BindAddr));
BindAddr.type = NETTYPE_ALL;
}
for(auto &i : m_NetClient)
for(auto &NetClient : m_NetClient)
{
do
{
BindAddr.port = (secure_rand() % 64511) + 1024;
} while(!i.Open(BindAddr, 0));
} while(!NetClient.Open(BindAddr, 0));
}
}

View file

@ -757,12 +757,12 @@ void CGraphics_Threaded::SetColor(float r, float g, float b, float a)
b *= 255.f;
a *= 255.f;
for(auto &i : m_aColor)
for(auto &Color : m_aColor)
{
i.r = (unsigned char)(r);
i.g = (unsigned char)(g);
i.b = (unsigned char)(b);
i.a = (unsigned char)(a);
Color.r = (unsigned char)(r);
Color.g = (unsigned char)(g);
Color.b = (unsigned char)(b);
Color.a = (unsigned char)(a);
}
}
@ -2022,8 +2022,8 @@ int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerIn
mem_copy(Cmd.m_Attributes, &pContainerInfo->m_Attributes[0], Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
for(auto &m_Attribute : pContainerInfo->m_Attributes)
m_VertexArrayInfo[Index].m_AssociatedBufferObjectIndices.push_back(m_Attribute.m_VertBufferBindingIndex);
for(auto &Attribute : pContainerInfo->m_Attributes)
m_VertexArrayInfo[Index].m_AssociatedBufferObjectIndices.push_back(Attribute.m_VertBufferBindingIndex);
return Index;
}
@ -2110,8 +2110,8 @@ void CGraphics_Threaded::UpdateBufferContainer(int ContainerIndex, SBufferContai
mem_copy(Cmd.m_Attributes, &pContainerInfo->m_Attributes[0], Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndices.clear();
for(auto &m_Attribute : pContainerInfo->m_Attributes)
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndices.push_back(m_Attribute.m_VertBufferBindingIndex);
for(auto &Attribute : pContainerInfo->m_Attributes)
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndices.push_back(Attribute.m_VertBufferBindingIndex);
}
void CGraphics_Threaded::IndicesNumRequiredNotify(unsigned int RequiredIndicesCount)
@ -2292,8 +2292,8 @@ int CGraphics_Threaded::Init()
return -1;
// create command buffers
for(auto &m_apCommandBuffer : m_apCommandBuffers)
m_apCommandBuffer = new CCommandBuffer(CMD_BUFFER_CMD_BUFFER_SIZE, CMD_BUFFER_DATA_BUFFER_SIZE);
for(auto &pCommandBuffer : m_apCommandBuffers)
pCommandBuffer = new CCommandBuffer(CMD_BUFFER_CMD_BUFFER_SIZE, CMD_BUFFER_DATA_BUFFER_SIZE);
m_pCommandBuffer = m_apCommandBuffers[0];
// create null texture, will get id=0
@ -2315,8 +2315,8 @@ void CGraphics_Threaded::Shutdown()
m_pBackend = 0x0;
// delete the command buffers
for(auto &m_apCommandBuffer : m_apCommandBuffers)
delete m_apCommandBuffer;
for(auto &pCommandBuffer : m_apCommandBuffers)
delete pCommandBuffer;
}
int CGraphics_Threaded::GetNumScreens() const
@ -2377,8 +2377,8 @@ void CGraphics_Threaded::Resize(int w, int h)
KickCommandBuffer();
WaitForIdle();
for(auto &m_ResizeListener : m_ResizeListeners)
m_ResizeListener.m_pFunc(m_ResizeListener.m_pUser);
for(auto &ResizeListener : m_ResizeListeners)
ResizeListener.m_pFunc(ResizeListener.m_pUser);
}
void CGraphics_Threaded::AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc, void *pUser)

View file

@ -56,9 +56,9 @@ bool HttpInit(IStorage *pStorage)
dbg_msg("http", "libcurl version %s (compiled = " LIBCURL_VERSION ")", pVersion->version);
}
for(auto &gs_aLock : gs_aLocks)
for(auto &Lock : gs_aLocks)
{
gs_aLock = lock_create();
Lock = lock_create();
}
curl_share_setopt(gs_Share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
curl_share_setopt(gs_Share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);

View file

@ -479,11 +479,11 @@ CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR &Addr)
}
// check if it's an official server
for(auto &m_aNetwork : m_aNetworks)
for(auto &Network : m_aNetworks)
{
for(int i = 0; i < m_aNetwork.m_NumCountries; i++)
for(int i = 0; i < Network.m_NumCountries; i++)
{
CNetworkCountry *pCntr = &m_aNetwork.m_aCountries[i];
CNetworkCountry *pCntr = &Network.m_aCountries[i];
for(int j = 0; j < pCntr->m_NumServers; j++)
{
if(net_addr_comp(&Addr, &pCntr->m_aServers[j]) == 0)
@ -1139,11 +1139,11 @@ void CServerBrowser::LoadDDNetServers()
void CServerBrowser::RecheckOfficial()
{
for(auto &m_aNetwork : m_aNetworks)
for(auto &Network : m_aNetworks)
{
for(int i = 0; i < m_aNetwork.m_NumCountries; i++)
for(int i = 0; i < Network.m_NumCountries; i++)
{
CNetworkCountry *pCntr = &m_aNetwork.m_aCountries[i];
CNetworkCountry *pCntr = &Network.m_aCountries[i];
for(int j = 0; j < pCntr->m_NumServers; j++)
{
CServerEntry *pEntry = Find(pCntr->m_aServers[j]);
@ -1321,11 +1321,11 @@ void CServerBrowser::CountryFilterClean(int Network)
char aNewList[128];
aNewList[0] = '\0';
for(auto &m_aNetwork : m_aNetworks)
for(auto &Network : m_aNetworks)
{
for(int i = 0; i < m_aNetwork.m_NumCountries; i++)
for(int i = 0; i < Network.m_NumCountries; i++)
{
const char *pName = m_aNetwork.m_aCountries[i].m_aName;
const char *pName = Network.m_aCountries[i].m_aName;
if(DDNetFiltered(pExcludeCountries, pName))
{
char aBuf[128];

View file

@ -115,37 +115,36 @@ static void Mix(short *pFinalOut, unsigned Frames)
MasterVol = m_SoundVolume;
for(auto &m_aVoice : m_aVoices)
for(auto &Voice : m_aVoices)
{
if(m_aVoice.m_pSample)
if(Voice.m_pSample)
{
// mix voice
CVoice *v = &m_aVoice;
int *pOut = m_pMixBuffer;
int Step = v->m_pSample->m_Channels; // setup input sources
short *pInL = &v->m_pSample->m_pData[v->m_Tick * Step];
short *pInR = &v->m_pSample->m_pData[v->m_Tick * Step + 1];
int Step = Voice.m_pSample->m_Channels; // setup input sources
short *pInL = &Voice.m_pSample->m_pData[Voice.m_Tick * Step];
short *pInR = &Voice.m_pSample->m_pData[Voice.m_Tick * Step + 1];
unsigned End = v->m_pSample->m_NumFrames - v->m_Tick;
unsigned End = Voice.m_pSample->m_NumFrames - Voice.m_Tick;
int Rvol = (int)(v->m_pChannel->m_Vol * (v->m_Vol / 255.0f));
int Lvol = (int)(v->m_pChannel->m_Vol * (v->m_Vol / 255.0f));
int Rvol = (int)(Voice.m_pChannel->m_Vol * (Voice.m_Vol / 255.0f));
int Lvol = (int)(Voice.m_pChannel->m_Vol * (Voice.m_Vol / 255.0f));
// make sure that we don't go outside the sound data
if(Frames < End)
End = Frames;
// check if we have a mono sound
if(v->m_pSample->m_Channels == 1)
if(Voice.m_pSample->m_Channels == 1)
pInR = pInL;
// volume calculation
if(v->m_Flags & ISound::FLAG_POS && v->m_pChannel->m_Pan)
if(Voice.m_Flags & ISound::FLAG_POS && Voice.m_pChannel->m_Pan)
{
// TODO: we should respect the channel panning value
int dx = v->m_X - m_CenterX;
int dy = v->m_Y - m_CenterY;
int dx = Voice.m_X - m_CenterX;
int dy = Voice.m_Y - m_CenterY;
//
int p = IntAbs(dx);
float FalloffX = 0.0f;
@ -154,11 +153,11 @@ static void Mix(short *pFinalOut, unsigned Frames)
int RangeX = 0; // for panning
bool InVoiceField = false;
switch(v->m_Shape)
switch(Voice.m_Shape)
{
case ISound::SHAPE_CIRCLE:
{
float r = v->m_Circle.m_Radius;
float r = Voice.m_Circle.m_Radius;
RangeX = r;
int Dist = (int)sqrtf((float)dx * dx + dy * dy); // nasty float
@ -167,7 +166,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
InVoiceField = true;
// falloff
int FalloffDistance = r * v->m_Falloff;
int FalloffDistance = r * Voice.m_Falloff;
if(Dist > FalloffDistance)
FalloffX = FalloffY = (r - Dist) / (r - FalloffDistance);
else
@ -181,21 +180,21 @@ static void Mix(short *pFinalOut, unsigned Frames)
case ISound::SHAPE_RECTANGLE:
{
RangeX = v->m_Rectangle.m_Width / 2.0f;
RangeX = Voice.m_Rectangle.m_Width / 2.0f;
int abs_dx = abs(dx);
int abs_dy = abs(dy);
int w = v->m_Rectangle.m_Width / 2.0f;
int h = v->m_Rectangle.m_Height / 2.0f;
int w = Voice.m_Rectangle.m_Width / 2.0f;
int h = Voice.m_Rectangle.m_Height / 2.0f;
if(abs_dx < w && abs_dy < h)
{
InVoiceField = true;
// falloff
int fx = v->m_Falloff * w;
int fy = v->m_Falloff * h;
int fx = Voice.m_Falloff * w;
int fy = Voice.m_Falloff * h;
FalloffX = abs_dx > fx ? (float)(w - abs_dx) / (w - fx) : 1.0f;
FalloffY = abs_dy > fy ? (float)(h - abs_dy) / (h - fy) : 1.0f;
@ -210,7 +209,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
if(InVoiceField)
{
// panning
if(!(v->m_Flags & ISound::FLAG_NO_PANNING))
if(!(Voice.m_Flags & ISound::FLAG_NO_PANNING))
{
if(dx > 0)
Lvol = ((RangeX - p) * Lvol) / RangeX;
@ -237,18 +236,18 @@ static void Mix(short *pFinalOut, unsigned Frames)
*pOut++ += (*pInR) * Rvol;
pInL += Step;
pInR += Step;
v->m_Tick++;
Voice.m_Tick++;
}
// free voice if not used any more
if(v->m_Tick == v->m_pSample->m_NumFrames)
if(Voice.m_Tick == Voice.m_pSample->m_NumFrames)
{
if(v->m_Flags & ISound::FLAG_LOOP)
v->m_Tick = 0;
if(Voice.m_Flags & ISound::FLAG_LOOP)
Voice.m_Tick = 0;
else
{
v->m_pSample = 0;
v->m_Age++;
Voice.m_pSample = 0;
Voice.m_Age++;
}
}
}
@ -937,15 +936,15 @@ void CSound::Stop(int SampleID)
// TODO: a nice fade out
lock_wait(m_SoundLock);
CSample *pSample = &m_aSamples[SampleID];
for(auto &m_aVoice : m_aVoices)
for(auto &Voice : m_aVoices)
{
if(m_aVoice.m_pSample == pSample)
if(Voice.m_pSample == pSample)
{
if(m_aVoice.m_Flags & FLAG_LOOP)
m_aVoice.m_pSample->m_PausedAt = m_aVoice.m_Tick;
if(Voice.m_Flags & FLAG_LOOP)
Voice.m_pSample->m_PausedAt = Voice.m_Tick;
else
m_aVoice.m_pSample->m_PausedAt = 0;
m_aVoice.m_pSample = 0;
Voice.m_pSample->m_PausedAt = 0;
Voice.m_pSample = 0;
}
}
lock_unlock(m_SoundLock);
@ -955,16 +954,16 @@ void CSound::StopAll()
{
// TODO: a nice fade out
lock_wait(m_SoundLock);
for(auto &m_aVoice : m_aVoices)
for(auto &Voice : m_aVoices)
{
if(m_aVoice.m_pSample)
if(Voice.m_pSample)
{
if(m_aVoice.m_Flags & FLAG_LOOP)
m_aVoice.m_pSample->m_PausedAt = m_aVoice.m_Tick;
if(Voice.m_Flags & FLAG_LOOP)
Voice.m_pSample->m_PausedAt = Voice.m_Tick;
else
m_aVoice.m_pSample->m_PausedAt = 0;
Voice.m_pSample->m_PausedAt = 0;
}
m_aVoice.m_pSample = 0;
Voice.m_pSample = 0;
}
lock_unlock(m_SoundLock);
}

View file

@ -85,9 +85,9 @@ public:
free(m_pBuf);
delete[] m_TextureData[0];
delete[] m_TextureData[1];
for(auto &m_FtFallbackFont : m_FtFallbackFonts)
for(auto &FtFallbackFont : m_FtFallbackFonts)
{
free(m_FtFallbackFont.m_pBuf);
free(FtFallbackFont.m_pBuf);
}
}
@ -600,16 +600,16 @@ public:
virtual ~CTextRender()
{
for(auto &m_Font : m_Fonts)
for(auto &pFont : m_Fonts)
{
FT_Done_Face(m_Font->m_FtFace);
FT_Done_Face(pFont->m_FtFace);
for(CFont::SFontFallBack &FallbackFont : m_Font->m_FtFallbackFonts)
for(CFont::SFontFallBack &FallbackFont : pFont->m_FtFallbackFonts)
{
FT_Done_Face(FallbackFont.m_FtFace);
}
delete m_Font;
delete pFont;
}
if(m_FTLibrary != 0)
@ -733,10 +733,10 @@ public:
CFont *GetFont(const char *pFilename)
{
for(auto &m_Font : m_Fonts)
for(auto &pFont : m_Fonts)
{
if(str_comp(pFilename, m_Font->m_aFilename) == 0)
return m_Font;
if(str_comp(pFilename, pFont->m_aFilename) == 0)
return pFont;
}
return NULL;
@ -1975,8 +1975,8 @@ public:
virtual void OnWindowResize()
{
bool FoundTextContainer = false;
for(auto &m_TextContainer : m_TextContainers)
if(m_TextContainer.m_StringInfo.m_QuadBufferContainerIndex != -1)
for(auto &TextContainer : m_TextContainers)
if(TextContainer.m_StringInfo.m_QuadBufferContainerIndex != -1)
FoundTextContainer = true;
if(FoundTextContainer)
{
@ -1984,19 +1984,19 @@ public:
dbg_assert(false, "text container was not empty");
}
for(auto &m_Font : m_Fonts)
for(auto &pFont : m_Fonts)
{
// reset the skylines
for(int j = 0; j < 2; ++j)
{
for(int & k : m_Font->m_TextureSkyline[j].m_CurHeightOfPixelColumn)
for(int &k : pFont->m_TextureSkyline[j].m_CurHeightOfPixelColumn)
k = 0;
mem_zero(m_Font->m_TextureData[j], (size_t)m_Font->m_CurTextureDimensions[j] * m_Font->m_CurTextureDimensions[j] * sizeof(unsigned char));
Graphics()->LoadTextureRawSub(m_Font->m_aTextures[j], 0, 0, m_Font->m_CurTextureDimensions[j], m_Font->m_CurTextureDimensions[j], CImageInfo::FORMAT_ALPHA, m_Font->m_TextureData[j]);
mem_zero(pFont->m_TextureData[j], (size_t)pFont->m_CurTextureDimensions[j] * pFont->m_CurTextureDimensions[j] * sizeof(unsigned char));
Graphics()->LoadTextureRawSub(pFont->m_aTextures[j], 0, 0, pFont->m_CurTextureDimensions[j], pFont->m_CurTextureDimensions[j], CImageInfo::FORMAT_ALPHA, pFont->m_TextureData[j]);
}
m_Font->InitFontSizes();
pFont->InitFontSizes();
}
}
};

View file

@ -312,11 +312,11 @@ void CUpdater::PerformUpdate()
}
}
for(auto &m_FileJob : m_FileJobs)
for(auto &FileJob : m_FileJobs)
{
if(m_FileJob.second)
if(FileJob.second)
{
const char *pFile = m_FileJob.first.c_str();
const char *pFile = FileJob.first.c_str();
size_t len = str_length(pFile);
if(!str_comp_nocase(pFile + len - 4, ".dll"))
{
@ -347,7 +347,7 @@ void CUpdater::PerformUpdate()
pLastFile = pFile;
}
else
m_pStorage->RemoveBinaryFile(m_FileJob.first.c_str());
m_pStorage->RemoveBinaryFile(FileJob.first.c_str());
}
if(m_ServerUpdate)
@ -368,9 +368,9 @@ void CUpdater::CommitUpdate()
{
bool Success = true;
for(auto &m_FileJob : m_FileJobs)
if(m_FileJob.second)
Success &= MoveFile(m_FileJob.first.c_str());
for(auto &FileJob : m_FileJobs)
if(FileJob.second)
Success &= MoveFile(FileJob.first.c_str());
if(m_ClientUpdate)
Success &= ReplaceClient();

View file

@ -66,15 +66,15 @@ int CAuthManager::AddKey(const char *pIdent, const char *pPw, int AuthLevel)
int CAuthManager::RemoveKey(int Slot)
{
m_aKeys.remove_index_fast(Slot);
for(int &i : m_aDefault)
for(int &Default : m_aDefault)
{
if(i == Slot)
if(Default == Slot)
{
i = -1;
Default = -1;
}
else if(i == m_aKeys.size())
else if(Default == m_aKeys.size())
{
i = Slot;
Default = Slot;
}
}
return m_aKeys.size();

View file

@ -32,13 +32,13 @@ CRegister::CRegister(bool Sixup)
void CRegister::FeedToken(NETADDR Addr, SECURITY_TOKEN ResponseToken)
{
Addr.port = 0;
for(auto &i : m_aMasterserverInfo)
for(auto &MasterserverInfo : m_aMasterserverInfo)
{
NETADDR Addr2 = i.m_Addr;
NETADDR Addr2 = MasterserverInfo.m_Addr;
Addr2.port = 0;
if(net_addr_comp(&Addr, &Addr2) == 0)
{
i.m_Token = ResponseToken;
MasterserverInfo.m_Token = ResponseToken;
break;
}
}
@ -108,11 +108,11 @@ void CRegister::RegisterGotCount(CNetChunk *pChunk)
unsigned char *pData = (unsigned char *)pChunk->m_pData;
int Count = (pData[sizeof(SERVERBROWSE_COUNT)] << 8) | pData[sizeof(SERVERBROWSE_COUNT) + 1];
for(auto &i : m_aMasterserverInfo)
for(auto &MasterserverInfo : m_aMasterserverInfo)
{
if(net_addr_comp(&i.m_Addr, &pChunk->m_Address) == 0)
if(net_addr_comp(&MasterserverInfo.m_Addr, &pChunk->m_Address) == 0)
{
i.m_Count = Count;
MasterserverInfo.m_Count = Count;
break;
}
}
@ -183,21 +183,21 @@ void CRegister::RegisterUpdate(int Nettype)
else if(m_RegisterState == REGISTERSTATE_QUERY_COUNT)
{
int Left = 0;
for(auto &i : m_aMasterserverInfo)
for(auto &MasterserverInfo : m_aMasterserverInfo)
{
if(!i.m_Valid)
if(!MasterserverInfo.m_Valid)
continue;
if(i.m_Count == -1)
if(MasterserverInfo.m_Count == -1)
{
Left++;
if(i.m_LastSend + Freq < Now)
if(MasterserverInfo.m_LastSend + Freq < Now)
{
i.m_LastSend = Now;
if(m_Sixup && i.m_Token == NET_SECURITY_TOKEN_UNKNOWN)
m_pNetServer->SendTokenSixup(i.m_Addr, NET_SECURITY_TOKEN_UNKNOWN);
MasterserverInfo.m_LastSend = Now;
if(m_Sixup && MasterserverInfo.m_Token == NET_SECURITY_TOKEN_UNKNOWN)
m_pNetServer->SendTokenSixup(MasterserverInfo.m_Addr, NET_SECURITY_TOKEN_UNKNOWN);
else
RegisterSendCountRequest(i.m_Addr, i.m_Token);
RegisterSendCountRequest(MasterserverInfo.m_Addr, MasterserverInfo.m_Token);
}
}
}
@ -280,9 +280,9 @@ int CRegister::RegisterProcessPacket(CNetChunk *pPacket, SECURITY_TOKEN Response
{
// check for masterserver address
bool Valid = false;
for(auto &i : m_aMasterserverInfo)
for(auto &MasterserverInfo : m_aMasterserverInfo)
{
if(net_addr_comp_noport(&pPacket->m_Address, &i.m_Addr) == 0)
if(net_addr_comp_noport(&pPacket->m_Address, &MasterserverInfo.m_Addr) == 0)
{
Valid = true;
break;

View file

@ -269,8 +269,8 @@ void CServerBan::ConBanRegionRange(IConsole::IResult *pResult, void *pUser)
void CServer::CClient::Reset()
{
// reset input
for(auto &m_aInput : m_aInputs)
m_aInput.m_GameTick = -1;
for(auto &Input : m_aInputs)
Input.m_GameTick = -1;
m_CurrentInput = 0;
mem_zero(&m_LatestInput, sizeof(m_LatestInput));
@ -502,19 +502,19 @@ int64 CServer::TickStartTime(int Tick)
int CServer::Init()
{
for(auto &m_aClient : m_aClients)
for(auto &Client : m_aClients)
{
m_aClient.m_State = CClient::STATE_EMPTY;
m_aClient.m_aName[0] = 0;
m_aClient.m_aClan[0] = 0;
m_aClient.m_Country = -1;
m_aClient.m_Snapshots.Init();
m_aClient.m_Traffic = 0;
m_aClient.m_TrafficSince = 0;
m_aClient.m_ShowIps = false;
m_aClient.m_AuthKey = -1;
m_aClient.m_Latency = 0;
m_aClient.m_Sixup = false;
Client.m_State = CClient::STATE_EMPTY;
Client.m_aName[0] = 0;
Client.m_aClan[0] = 0;
Client.m_Country = -1;
Client.m_Snapshots.Init();
Client.m_Traffic = 0;
Client.m_TrafficSince = 0;
Client.m_ShowIps = false;
Client.m_AuthKey = -1;
Client.m_Latency = 0;
Client.m_Sixup = false;
}
m_CurrentGameTick = 0;
@ -641,9 +641,9 @@ int CServer::MaxClients() const
int CServer::ClientCount()
{
int ClientCount = 0;
for(auto &m_aClient : m_aClients)
for(auto &Client : m_aClients)
{
if(m_aClient.m_State != CClient::STATE_EMPTY)
if(Client.m_State != CClient::STATE_EMPTY)
{
ClientCount++;
}
@ -2533,9 +2533,9 @@ int CServer::Run()
{
for(int c = 0; c < MAX_CLIENTS; c++)
if(m_aClients[c].m_State == CClient::STATE_INGAME)
for(auto &m_aInput : m_aClients[c].m_aInputs)
if(m_aInput.m_GameTick == Tick() + 1)
GameServer()->OnClientPredictedEarlyInput(c, m_aInput.m_aData);
for(auto &Input : m_aClients[c].m_aInputs)
if(Input.m_GameTick == Tick() + 1)
GameServer()->OnClientPredictedEarlyInput(c, Input.m_aData);
m_CurrentGameTick++;
NewTicks++;
@ -2545,11 +2545,11 @@ int CServer::Run()
{
if(m_aClients[c].m_State != CClient::STATE_INGAME)
continue;
for(auto &m_aInput : m_aClients[c].m_aInputs)
for(auto &Input : m_aClients[c].m_aInputs)
{
if(m_aInput.m_GameTick == Tick())
if(Input.m_GameTick == Tick())
{
GameServer()->OnClientPredictedInput(c, m_aInput.m_aData);
GameServer()->OnClientPredictedInput(c, Input.m_aData);
break;
}
}
@ -2590,8 +2590,8 @@ int CServer::Run()
NonActive = true;
for(auto &m_aClient : m_aClients)
if(m_aClient.m_State != CClient::STATE_EMPTY)
for(auto &Client : m_aClients)
if(Client.m_State != CClient::STATE_EMPTY)
NonActive = false;
// wait for incoming data
@ -2647,8 +2647,8 @@ int CServer::Run()
GameServer()->OnShutdown();
m_pMap->Unload();
for(auto &i : m_apCurrentMapData)
free(i);
for(auto &pCurrentMapData : m_apCurrentMapData)
free(pCurrentMapData);
DbPool()->OnShutdown();
delete m_pConnectionPool;
@ -2760,9 +2760,9 @@ void CServer::AuthRemoveKey(int KeySlot)
// Update indices.
if(OldKeySlot != NewKeySlot)
{
for(auto &m_aClient : m_aClients)
if(m_aClient.m_AuthKey == OldKeySlot)
m_aClient.m_AuthKey = NewKeySlot;
for(auto &Client : m_aClients)
if(Client.m_AuthKey == OldKeySlot)
Client.m_AuthKey = NewKeySlot;
}
}

View file

@ -549,9 +549,9 @@ SHA256_DIGEST CDataFileReader::Sha256()
if(!m_pDataFile)
{
SHA256_DIGEST Result;
for(unsigned char &i : Result.data)
for(unsigned char &d : Result.data)
{
i = 0xff;
d = 0xff;
}
return Result;
}

View file

@ -63,8 +63,8 @@ void CEcon::Init(IConsole *pConsole, CNetBan *pNetBan)
{
m_pConsole = pConsole;
for(auto &m_aClient : m_aClients)
m_aClient.m_State = CClient::STATE_EMPTY;
for(auto &Client : m_aClients)
Client.m_State = CClient::STATE_EMPTY;
m_Ready = false;
m_UserClientID = -1;

View file

@ -168,11 +168,11 @@ public:
{
Info.m_Addr.port = 8300;
bool Added = false;
for(auto &m_aMasterServer : m_aMasterServers)
for(auto &MasterServer : m_aMasterServers)
{
if(str_comp(m_aMasterServer.m_aHostname, Info.m_aHostname) == 0)
if(str_comp(MasterServer.m_aHostname, Info.m_aHostname) == 0)
{
m_aMasterServer = Info;
MasterServer = Info;
Added = true;
break;
}
@ -180,11 +180,11 @@ public:
if(!Added)
{
for(auto &m_aMasterServer : m_aMasterServers)
for(auto &MasterServer : m_aMasterServers)
{
if(m_aMasterServer.m_Addr.type == NETTYPE_INVALID)
if(MasterServer.m_Addr.type == NETTYPE_INVALID)
{
m_aMasterServer = Info;
MasterServer = Info;
Added = true;
break;
}
@ -210,15 +210,15 @@ public:
if(!File)
return -1;
for(auto &m_aMasterServer : m_aMasterServers)
for(auto &MasterServer : m_aMasterServers)
{
char aAddrStr[NETADDR_MAXSTRSIZE];
if(m_aMasterServer.m_Addr.type != NETTYPE_INVALID)
net_addr_str(&m_aMasterServer.m_Addr, aAddrStr, sizeof(aAddrStr), true);
if(MasterServer.m_Addr.type != NETTYPE_INVALID)
net_addr_str(&MasterServer.m_Addr, aAddrStr, sizeof(aAddrStr), true);
else
aAddrStr[0] = 0;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s %s", m_aMasterServer.m_aHostname, aAddrStr);
str_format(aBuf, sizeof(aBuf), "%s %s", MasterServer.m_aHostname, aAddrStr);
io_write(File, aBuf, str_length(aBuf));
io_write_newline(File);
}

View file

@ -24,8 +24,8 @@ bool CNetConsole::Open(NETADDR BindAddr, CNetBan *pNetBan, int Flags)
return false;
net_set_non_blocking(m_Socket);
for(auto &m_aSlot : m_aSlots)
m_aSlot.m_Connection.Reset();
for(auto &Slot : m_aSlots)
Slot.m_Connection.Reset();
return true;
}
@ -39,8 +39,8 @@ void CNetConsole::SetCallbacks(NETFUNC_NEWCLIENT_CON pfnNewClient, NETFUNC_DELCL
int CNetConsole::Close()
{
for(auto &m_aSlot : m_aSlots)
m_aSlot.m_Connection.Disconnect("closing console");
for(auto &Slot : m_aSlots)
Slot.m_Connection.Disconnect("closing console");
net_tcp_close(m_Socket);

View file

@ -76,8 +76,8 @@ bool CNetServer::Open(NETADDR BindAddr, CNetBan *pNetBan, int MaxClients, int Ma
secure_random_fill(m_SecurityTokenSeed, sizeof(m_SecurityTokenSeed));
for(auto &m_aSlot : m_aSlots)
m_aSlot.m_Connection.Init(m_Socket, true);
for(auto &Slot : m_aSlots)
Slot.m_Connection.Init(m_Socket, true);
net_init_mmsgs(&m_MMSGS);

View file

@ -33,9 +33,9 @@ CBinds::CBinds()
CBinds::~CBinds()
{
for(int i = 0; i < KEY_LAST; i++)
for(auto &m_aapKeyBinding : m_aapKeyBindings)
if(m_aapKeyBinding[i])
free(m_aapKeyBinding[i]);
for(auto &apKeyBinding : m_aapKeyBindings)
if(apKeyBinding[i])
free(apKeyBinding[i]);
}
void CBinds::Bind(int KeyID, const char *pStr, bool FreeOnly, int Modifier)
@ -158,13 +158,13 @@ bool CBinds::OnInput(IInput::CEvent e)
void CBinds::UnbindAll()
{
for(auto &m_aapKeyBinding : m_aapKeyBindings)
for(auto &apKeyBinding : m_aapKeyBindings)
{
for(auto & j : m_aapKeyBinding)
for(auto &pKeyBinding : apKeyBinding)
{
if(j)
free(j);
j = 0;
if(pKeyBinding)
free(pKeyBinding);
pKeyBinding = 0;
}
}
}

View file

@ -27,11 +27,11 @@
CChat::CChat()
{
for(auto &m_aLine : m_aLines)
for(auto &Line : m_aLines)
{
// reset the container indices, so the text containers can be deleted on reset
m_aLine.m_TextContainerIndex = -1;
m_aLine.m_QuadContainerIndex = -1;
Line.m_TextContainerIndex = -1;
Line.m_QuadContainerIndex = -1;
}
#define CHAT_COMMAND(name, params, flags, callback, userdata, help) RegisterCommand(name, params, flags, help);
@ -49,17 +49,17 @@ void CChat::RegisterCommand(const char *pName, const char *pParams, int flags, c
void CChat::RebuildChat()
{
for(auto &m_aLine : m_aLines)
for(auto &Line : m_aLines)
{
if(m_aLine.m_TextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aLine.m_TextContainerIndex);
m_aLine.m_TextContainerIndex = -1;
if(m_aLine.m_QuadContainerIndex != -1)
Graphics()->DeleteQuadContainer(m_aLine.m_QuadContainerIndex);
m_aLine.m_QuadContainerIndex = -1;
if(Line.m_TextContainerIndex != -1)
TextRender()->DeleteTextContainer(Line.m_TextContainerIndex);
Line.m_TextContainerIndex = -1;
if(Line.m_QuadContainerIndex != -1)
Graphics()->DeleteQuadContainer(Line.m_QuadContainerIndex);
Line.m_QuadContainerIndex = -1;
// recalculate sizes
m_aLine.m_YOffset[0] = -1.f;
m_aLine.m_YOffset[1] = -1.f;
Line.m_YOffset[0] = -1.f;
Line.m_YOffset[1] = -1.f;
}
}
@ -70,20 +70,20 @@ void CChat::OnWindowResize()
void CChat::Reset()
{
for(auto &m_aLine : m_aLines)
for(auto &Line : m_aLines)
{
if(m_aLine.m_TextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aLine.m_TextContainerIndex);
if(m_aLine.m_QuadContainerIndex != -1)
Graphics()->DeleteQuadContainer(m_aLine.m_QuadContainerIndex);
m_aLine.m_Time = 0;
m_aLine.m_aText[0] = 0;
m_aLine.m_aName[0] = 0;
m_aLine.m_Friend = false;
m_aLine.m_TextContainerIndex = -1;
m_aLine.m_QuadContainerIndex = -1;
m_aLine.m_TimesRepeated = 0;
m_aLine.m_HasRenderTee = false;
if(Line.m_TextContainerIndex != -1)
TextRender()->DeleteTextContainer(Line.m_TextContainerIndex);
if(Line.m_QuadContainerIndex != -1)
Graphics()->DeleteQuadContainer(Line.m_QuadContainerIndex);
Line.m_Time = 0;
Line.m_aText[0] = 0;
Line.m_aName[0] = 0;
Line.m_Friend = false;
Line.m_TextContainerIndex = -1;
Line.m_QuadContainerIndex = -1;
Line.m_TimesRepeated = 0;
Line.m_HasRenderTee = false;
}
m_PrevScoreBoardShowed = false;
m_PrevShowChat = false;
@ -102,8 +102,8 @@ void CChat::Reset()
m_CurrentLine = 0;
DisableMode();
for(long long &i : m_aLastSoundPlayed)
i = 0;
for(long long &LastSoundPlayed : m_aLastSoundPlayed)
LastSoundPlayed = 0;
}
void CChat::OnRelease()

View file

@ -71,8 +71,8 @@ void CControls::OnReset()
m_JoystickFirePressed = false;
m_JoystickRunPressed = false;
m_JoystickTapTime = 0;
for(int &i : m_AmmoCount)
i = 0;
for(int &AmmoCount : m_AmmoCount)
AmmoCount = 0;
m_OldMouseX = m_OldMouseY = 0.0f;
}
@ -100,8 +100,8 @@ void CControls::OnPlayerDeath()
{
if(g_Config.m_ClResetWantedWeaponOnDeath)
m_LastData[g_Config.m_ClDummy].m_WantedWeapon = m_InputData[g_Config.m_ClDummy].m_WantedWeapon = 0;
for(int &i : m_AmmoCount)
i = 0;
for(int &AmmoCount : m_AmmoCount)
AmmoCount = 0;
m_JoystickTapTime = 0; // Do not launch hook on first tap
}

View file

@ -102,8 +102,8 @@ void CCountryFlags::LoadCountryflagsIndexfile()
// init LUT
if(DefaultIndex != 0)
for(int &i : m_CodeIndexLUT)
i = DefaultIndex;
for(int &CodeIndexLUT : m_CodeIndexLUT)
CodeIndexLUT = DefaultIndex;
else
mem_zero(m_CodeIndexLUT, sizeof(m_CodeIndexLUT));
for(int i = 0; i < m_aCountryFlags.size(); ++i)

View file

@ -78,8 +78,8 @@ CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other)
void CGhost::CGhostPath::Reset(int ChunkSize)
{
for(auto &m_lChunk : m_lChunks)
free(m_lChunk);
for(auto &pChunk : m_lChunks)
free(pChunk);
m_lChunks.clear();
m_ChunkSize = ChunkSize;
m_NumItems = 0;
@ -167,8 +167,8 @@ int CGhost::GetSlot() const
int CGhost::FreeSlots() const
{
int Num = 0;
for(const auto &m_aActiveGhost : m_aActiveGhosts)
if(m_aActiveGhost.Empty())
for(const auto &ActiveGhost : m_aActiveGhosts)
if(ActiveGhost.Empty())
Num++;
return Num;
}
@ -308,32 +308,31 @@ void CGhost::OnRender()
int PlaybackTick = Client()->PredGameTick(g_Config.m_ClDummy) - m_StartRenderTick;
for(auto &m_aActiveGhost : m_aActiveGhosts)
for(auto &Ghost : m_aActiveGhosts)
{
CGhostItem *pGhost = &m_aActiveGhost;
if(pGhost->Empty())
if(Ghost.Empty())
continue;
int GhostTick = pGhost->m_StartTick + PlaybackTick;
while(pGhost->m_PlaybackPos >= 0 && pGhost->m_Path.Get(pGhost->m_PlaybackPos)->m_Tick < GhostTick)
int GhostTick = Ghost.m_StartTick + PlaybackTick;
while(Ghost.m_PlaybackPos >= 0 && Ghost.m_Path.Get(Ghost.m_PlaybackPos)->m_Tick < GhostTick)
{
if(pGhost->m_PlaybackPos < pGhost->m_Path.Size() - 1)
pGhost->m_PlaybackPos++;
if(Ghost.m_PlaybackPos < Ghost.m_Path.Size() - 1)
Ghost.m_PlaybackPos++;
else
pGhost->m_PlaybackPos = -1;
Ghost.m_PlaybackPos = -1;
}
if(pGhost->m_PlaybackPos < 0)
if(Ghost.m_PlaybackPos < 0)
continue;
int CurPos = pGhost->m_PlaybackPos;
int CurPos = Ghost.m_PlaybackPos;
int PrevPos = maximum(0, CurPos - 1);
if(pGhost->m_Path.Get(PrevPos)->m_Tick > GhostTick)
if(Ghost.m_Path.Get(PrevPos)->m_Tick > GhostTick)
continue;
CNetObj_Character Player, Prev;
GetNetObjCharacter(&Player, pGhost->m_Path.Get(CurPos));
GetNetObjCharacter(&Prev, pGhost->m_Path.Get(PrevPos));
GetNetObjCharacter(&Player, Ghost.m_Path.Get(CurPos));
GetNetObjCharacter(&Prev, Ghost.m_Path.Get(PrevPos));
int TickDiff = Player.m_Tick - Prev.m_Tick;
float IntraTick = 0.f;
@ -342,8 +341,8 @@ void CGhost::OnRender()
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &pGhost->m_RenderInfo, -2, IntraTick);
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &pGhost->m_RenderInfo, -2, IntraTick);
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
}
}
@ -431,8 +430,8 @@ void CGhost::StartRender(int Tick)
{
m_Rendering = true;
m_StartRenderTick = Tick;
for(auto &m_aActiveGhost : m_aActiveGhosts)
m_aActiveGhost.m_PlaybackPos = 0;
for(auto &Ghost : m_aActiveGhosts)
Ghost.m_PlaybackPos = 0;
}
void CGhost::StopRender()
@ -632,12 +631,12 @@ int CGhost::GetLastRaceTick()
void CGhost::RefindSkin()
{
char aSkinName[64];
for(auto &m_aActiveGhost : m_aActiveGhosts)
for(auto &Ghost : m_aActiveGhosts)
{
IntsToStr(&m_aActiveGhost.m_Skin.m_Skin0, 6, aSkinName);
IntsToStr(&Ghost.m_Skin.m_Skin0, 6, aSkinName);
if(aSkinName[0] != '\0')
{
CTeeRenderInfo *pRenderInfo = &m_aActiveGhost.m_RenderInfo;
CTeeRenderInfo *pRenderInfo = &Ghost.m_RenderInfo;
int SkinId = m_pClient->m_pSkins->Find(aSkinName);
const CSkin *pSkin = m_pClient->m_pSkins->Get(SkinId);

View file

@ -12,30 +12,30 @@
void CKillMessages::OnWindowResize()
{
for(auto &m_aKillmsg : m_aKillmsgs)
for(auto &Killmsg : m_aKillmsgs)
{
if(m_aKillmsg.m_VictimTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aKillmsg.m_VictimTextContainerIndex);
if(m_aKillmsg.m_KillerTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aKillmsg.m_KillerTextContainerIndex);
m_aKillmsg.m_VictimTextContainerIndex = m_aKillmsg.m_KillerTextContainerIndex = -1;
if(Killmsg.m_VictimTextContainerIndex != -1)
TextRender()->DeleteTextContainer(Killmsg.m_VictimTextContainerIndex);
if(Killmsg.m_KillerTextContainerIndex != -1)
TextRender()->DeleteTextContainer(Killmsg.m_KillerTextContainerIndex);
Killmsg.m_VictimTextContainerIndex = Killmsg.m_KillerTextContainerIndex = -1;
}
}
void CKillMessages::OnReset()
{
m_KillmsgCurrent = 0;
for(auto &m_aKillmsg : m_aKillmsgs)
for(auto &Killmsg : m_aKillmsgs)
{
m_aKillmsg.m_Tick = -100000;
Killmsg.m_Tick = -100000;
if(m_aKillmsg.m_VictimTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aKillmsg.m_VictimTextContainerIndex);
if(Killmsg.m_VictimTextContainerIndex != -1)
TextRender()->DeleteTextContainer(Killmsg.m_VictimTextContainerIndex);
if(m_aKillmsg.m_KillerTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aKillmsg.m_KillerTextContainerIndex);
if(Killmsg.m_KillerTextContainerIndex != -1)
TextRender()->DeleteTextContainer(Killmsg.m_KillerTextContainerIndex);
m_aKillmsg.m_VictimTextContainerIndex = m_aKillmsg.m_KillerTextContainerIndex = -1;
Killmsg.m_VictimTextContainerIndex = Killmsg.m_KillerTextContainerIndex = -1;
}
}

View file

@ -108,14 +108,14 @@ int CMenuBackground::ThemeScan(const char *pName, int IsDir, int DirType, void *
return 0;
// try to edit an existing theme
for(auto &m_lTheme : pSelf->m_lThemes)
for(auto &Theme : pSelf->m_lThemes)
{
if(str_comp(m_lTheme.m_Name, aThemeName) == 0)
if(str_comp(Theme.m_Name, aThemeName) == 0)
{
if(IsDay)
m_lTheme.m_HasDay = true;
Theme.m_HasDay = true;
if(IsNight)
m_lTheme.m_HasNight = true;
Theme.m_HasNight = true;
return 0;
}
}

View file

@ -1081,10 +1081,10 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
ServerDetails.VSplitLeft(5.0f, 0x0, &ServerDetails);
ServerDetails.VSplitLeft(80.0f, &LeftColumn, &RightColumn);
for(auto &s_aLabel : s_aLabels)
for(auto &Label : s_aLabels)
{
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
UI()->DoLabelScaled(&Row, s_aLabel, FontSize, -1);
UI()->DoLabelScaled(&Row, Label, FontSize, -1);
}
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);

View file

@ -248,12 +248,12 @@ void CMenus::RenderPlayers(CUIRect MainView)
int TotalPlayers = 0;
for(auto &i : m_pClient->m_Snap.m_paInfoByName)
for(auto &pInfoByName : m_pClient->m_Snap.m_paInfoByName)
{
if(!i)
if(!pInfoByName)
continue;
int Index = i->m_ClientID;
int Index = pInfoByName->m_ClientID;
if(Index == m_pClient->m_Snap.m_LocalClientID)
continue;
@ -561,13 +561,13 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
int NumOptions = 0;
int Selected = -1;
static int aPlayerIDs[MAX_CLIENTS];
for(auto &i : m_pClient->m_Snap.m_paInfoByName)
for(auto &pInfoByName : m_pClient->m_Snap.m_paInfoByName)
{
if(!i)
if(!pInfoByName)
continue;
int Index = i->m_ClientID;
if(Index == m_pClient->m_Snap.m_LocalClientID || (FilterSpectators && i->m_Team == TEAM_SPECTATORS))
int Index = pInfoByName->m_ClientID;
if(Index == m_pClient->m_Snap.m_LocalClientID || (FilterSpectators && pInfoByName->m_Team == TEAM_SPECTATORS))
continue;
if(!str_find_nocase(m_pClient->m_aClients[Index].m_aName, m_aFilterString))

View file

@ -529,13 +529,12 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
SkinPrefix.HSplitTop(2.0f, 0, &SkinPrefix);
{
static const char *s_aSkinPrefixes[] = {"kitty", "santa"};
for(auto &s_aSkinPrefixe : s_aSkinPrefixes)
for(auto &pPrefix : s_aSkinPrefixes)
{
const char *pPrefix = s_aSkinPrefixe;
CUIRect Button;
SkinPrefix.HSplitTop(20.0f, &Button, &SkinPrefix);
Button.HMargin(2.0f, &Button);
if(DoButton_Menu(&s_aSkinPrefixe, pPrefix, 0, &Button))
if(DoButton_Menu(&pPrefix, pPrefix, 0, &Button))
{
str_copy(g_Config.m_ClSkinPrefix, pPrefix, sizeof(g_Config.m_ClSkinPrefix));
}
@ -848,8 +847,8 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
char aBuf[128];
// this is kinda slow, but whatever
for(auto &gs_aKey : gs_aKeys)
gs_aKey.m_KeyId = gs_aKey.m_Modifier = 0;
for(auto &Key : gs_aKeys)
Key.m_KeyId = Key.m_Modifier = 0;
for(int Mod = 0; Mod < CBinds::MODIFIER_COUNT; Mod++)
{
@ -859,11 +858,11 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
if(!pBind[0])
continue;
for(auto &gs_aKey : gs_aKeys)
if(str_comp(pBind, gs_aKey.m_pCommand) == 0)
for(auto &Key : gs_aKeys)
if(str_comp(pBind, Key.m_pCommand) == 0)
{
gs_aKey.m_KeyId = KeyId;
gs_aKey.m_Modifier = Mod;
Key.m_KeyId = KeyId;
Key.m_Modifier = Mod;
break;
}
}

View file

@ -241,11 +241,11 @@ void CMenus::ClearCustomItems(int CurTab)
{
for(int i = 0; i < m_EntitiesList.size(); ++i)
{
for(auto &m_aImage : m_EntitiesList[i].m_aImages)
for(auto &Image : m_EntitiesList[i].m_aImages)
{
if(m_aImage.m_Texture != -1)
Graphics()->UnloadTexture(m_aImage.m_Texture);
m_aImage.m_Texture = IGraphics::CTextureHandle();
if(Image.m_Texture != -1)
Graphics()->UnloadTexture(Image.m_Texture);
Image.m_Texture = IGraphics::CTextureHandle();
}
}
m_EntitiesList.clear();

View file

@ -247,14 +247,14 @@ void CNamePlates::SetPlayers(CPlayers *pPlayers)
void CNamePlates::ResetNamePlates()
{
for(auto &m_aNamePlate : m_aNamePlates)
for(auto &NamePlate : m_aNamePlates)
{
if(m_aNamePlate.m_NameTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aNamePlate.m_NameTextContainerIndex);
if(m_aNamePlate.m_ClanNameTextContainerIndex != -1)
TextRender()->DeleteTextContainer(m_aNamePlate.m_ClanNameTextContainerIndex);
if(NamePlate.m_NameTextContainerIndex != -1)
TextRender()->DeleteTextContainer(NamePlate.m_NameTextContainerIndex);
if(NamePlate.m_ClanNameTextContainerIndex != -1)
TextRender()->DeleteTextContainer(NamePlate.m_ClanNameTextContainerIndex);
m_aNamePlate.Reset();
NamePlate.Reset();
}
}

View file

@ -30,8 +30,8 @@ void CParticles::OnReset()
m_aParticles[MAX_PARTICLES - 1].m_NextPart = -1;
m_FirstFree = 0;
for(int &i : m_aFirstPart)
i = -1;
for(int &FirstPart : m_aFirstPart)
FirstPart = -1;
}
void CParticles::Add(int Group, CParticle *pPart, float TimePassed)
@ -89,9 +89,9 @@ void CParticles::Update(float TimePassed)
FrictionFraction -= 0.05f;
}
for(int &g : m_aFirstPart)
for(int &FirstPart : m_aFirstPart)
{
int i = g;
int i = FirstPart;
while(i != -1)
{
int Next = m_aParticles[i].m_NextPart;
@ -116,7 +116,7 @@ void CParticles::Update(float TimePassed)
if(m_aParticles[i].m_PrevPart != -1)
m_aParticles[m_aParticles[i].m_PrevPart].m_NextPart = m_aParticles[i].m_NextPart;
else
g = m_aParticles[i].m_NextPart;
FirstPart = m_aParticles[i].m_NextPart;
if(m_aParticles[i].m_NextPart != -1)
m_aParticles[m_aParticles[i].m_NextPart].m_PrevPart = m_aParticles[i].m_PrevPart;

View file

@ -214,14 +214,14 @@ bool CRaceDemo::CheckDemo(int Time) const
Storage()->ListDirectoryInfo(IStorage::TYPE_SAVE, ms_pRaceDemoDir, RaceDemolistFetchCallback, &Param);
// loop through demo files
for(auto &lDemo : lDemos)
for(auto &Demo : lDemos)
{
if(Time >= lDemo.m_Time) // found a better demo
if(Time >= Demo.m_Time) // found a better demo
return false;
// delete old demo
char aFilename[512];
str_format(aFilename, sizeof(aFilename), "%s/%s.demo", ms_pRaceDemoDir, lDemo.m_aName);
str_format(aFilename, sizeof(aFilename), "%s/%s.demo", ms_pRaceDemoDir, Demo.m_aName);
Storage()->RemoveFile(aFilename, IStorage::TYPE_SAVE);
}

View file

@ -20,9 +20,9 @@ static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear",
static bool IsVanillaSkin(const char *pName)
{
for(auto &i : VANILLA_SKINS)
for(auto &pVanillaSkin : VANILLA_SKINS)
{
if(str_comp(pName, i) == 0)
if(str_comp(pName, pVanillaSkin) == 0)
{
return true;
}
@ -210,8 +210,8 @@ void CSkins::Refresh()
Graphics()->UnloadTextureNew(m_aSkins[i].m_OriginalSkin.m_FeetOutline);
Graphics()->UnloadTextureNew(m_aSkins[i].m_OriginalSkin.m_Hands);
Graphics()->UnloadTextureNew(m_aSkins[i].m_OriginalSkin.m_HandsOutline);
for(auto &m_Eye : m_aSkins[i].m_OriginalSkin.m_Eyes)
Graphics()->UnloadTextureNew(m_Eye);
for(auto &Eye : m_aSkins[i].m_OriginalSkin.m_Eyes)
Graphics()->UnloadTextureNew(Eye);
Graphics()->UnloadTextureNew(m_aSkins[i].m_ColorableSkin.m_Body);
Graphics()->UnloadTextureNew(m_aSkins[i].m_ColorableSkin.m_BodyOutline);
@ -219,8 +219,8 @@ void CSkins::Refresh()
Graphics()->UnloadTextureNew(m_aSkins[i].m_ColorableSkin.m_FeetOutline);
Graphics()->UnloadTextureNew(m_aSkins[i].m_ColorableSkin.m_Hands);
Graphics()->UnloadTextureNew(m_aSkins[i].m_ColorableSkin.m_HandsOutline);
for(auto &m_Eye : m_aSkins[i].m_ColorableSkin.m_Eyes)
Graphics()->UnloadTextureNew(m_Eye);
for(auto &Eye : m_aSkins[i].m_ColorableSkin.m_Eyes)
Graphics()->UnloadTextureNew(Eye);
}
m_aSkins.clear();

View file

@ -217,9 +217,9 @@ void CSpectator::OnRender()
float BoxMove = -10.0f;
float BoxOffset = 0.0f;
for(auto &i : m_pClient->m_Snap.m_paInfoByDDTeamName)
for(auto &pInfo : m_pClient->m_Snap.m_paInfoByDDTeamName)
{
if(!i || i->m_Team == TEAM_SPECTATORS)
if(!pInfo || pInfo->m_Team == TEAM_SPECTATORS)
continue;
++TotalPlayers;

View file

@ -19,8 +19,8 @@ CStatboard::CStatboard()
void CStatboard::OnReset()
{
for(auto &m_aStat : m_pClient->m_aStats)
m_aStat.Reset();
for(auto &Stat : m_pClient->m_aStats)
Stat.Reset();
m_Active = false;
m_ScreenshotTaken = false;
m_ScreenshotTime = -1;
@ -180,8 +180,8 @@ void CStatboard::RenderGlobalStats()
for(int j = 0; j < NUM_WEAPONS; j++)
aDisplayWeapon[j] = aDisplayWeapon[j] || pStats->m_aFragsWith[j] || pStats->m_aDeathsFrom[j];
}
for(bool i : aDisplayWeapon)
if(i)
for(bool DisplayWeapon : aDisplayWeapon)
if(DisplayWeapon)
StatboardContentWidth += 80;
float x = StatboardWidth / 2 - StatboardContentWidth / 2;

View file

@ -524,8 +524,8 @@ void CGameClient::OnConnected()
m_GameWorld.Clear();
m_GameWorld.m_WorldConfig.m_InfiniteAmmo = true;
m_PredictedDummyID = -1;
for(auto &m_aLastWorldCharacter : m_aLastWorldCharacters)
m_aLastWorldCharacter.m_Alive = false;
for(auto &LastWorldCharacter : m_aLastWorldCharacters)
LastWorldCharacter.m_Alive = false;
LoadMapSettings();
if(Client()->State() != IClient::STATE_DEMOPLAYBACK && g_Config.m_ClAutoDemoOnConnect)
@ -539,8 +539,8 @@ void CGameClient::OnReset()
InvalidateSnapshot();
for(auto &m_aClient : m_aClients)
m_aClient.Reset();
for(auto &Client : m_aClients)
Client.Reset();
for(int i = 0; i < m_All.m_Num; i++)
m_All.m_paComponents[i]->OnReset();
@ -1208,9 +1208,9 @@ void CGameClient::OnNewSnapshot()
bool FoundGameInfoEx = false;
for(auto &m_aClient : m_aClients)
for(auto &Client : m_aClients)
{
m_aClient.m_SpecCharPresent = false;
Client.m_SpecCharPresent = false;
}
// go trough all the items in the snapshot and gather the info we want
@ -2243,14 +2243,14 @@ void CGameClient::UpdatePrediction()
if(m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData)
{
int aIDs[MAX_CLIENTS];
for(int &aID : aIDs)
aID = -1;
for(int &ID : aIDs)
ID = -1;
for(int i = 0; i < MAX_CLIENTS; i++)
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
aIDs[pChar->GetStrongWeakID()] = i;
for(int aID : aIDs)
if(aID >= 0)
m_CharOrder.GiveStrong(aID);
for(int ID : aIDs)
if(ID >= 0)
m_CharOrder.GiveStrong(ID);
}
else
{
@ -2545,9 +2545,9 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponNinjaCursor);
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponLaserCursor);
for(auto &m_SpriteWeaponCursor : m_GameSkin.m_SpriteWeaponCursors)
for(auto &SpriteWeaponCursor : m_GameSkin.m_SpriteWeaponCursors)
{
m_SpriteWeaponCursor = IGraphics::CTextureHandle();
SpriteWeaponCursor = IGraphics::CTextureHandle();
}
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteHookChain);
@ -2559,19 +2559,19 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponNinja);
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponLaser);
for(auto &m_SpriteWeapon : m_GameSkin.m_SpriteWeapons)
for(auto &SpriteWeapon : m_GameSkin.m_SpriteWeapons)
{
m_SpriteWeapon = IGraphics::CTextureHandle();
SpriteWeapon = IGraphics::CTextureHandle();
}
for(auto &m_SpriteParticle : m_GameSkin.m_SpriteParticles)
for(auto &SpriteParticle : m_GameSkin.m_SpriteParticles)
{
Graphics()->UnloadTextureNew(m_SpriteParticle);
Graphics()->UnloadTextureNew(SpriteParticle);
}
for(auto &m_SpriteStar : m_GameSkin.m_SpriteStars)
for(auto &SpriteStar : m_GameSkin.m_SpriteStars)
{
Graphics()->UnloadTextureNew(m_SpriteStar);
Graphics()->UnloadTextureNew(SpriteStar);
}
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponGunProjectile);
@ -2581,9 +2581,9 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponNinjaProjectile);
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponLaserProjectile);
for(auto &m_SpriteWeaponProjectile : m_GameSkin.m_SpriteWeaponProjectiles)
for(auto &SpriteWeaponProjectile : m_GameSkin.m_SpriteWeaponProjectiles)
{
m_SpriteWeaponProjectile = IGraphics::CTextureHandle();
SpriteWeaponProjectile = IGraphics::CTextureHandle();
}
for(int i = 0; i < 3; ++i)
@ -2592,9 +2592,9 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponShotgunMuzzles[i]);
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteWeaponNinjaMuzzles[i]);
for(auto &m_SpriteWeaponsMuzzle : m_GameSkin.m_SpriteWeaponsMuzzles)
for(auto &SpriteWeaponsMuzzle : m_GameSkin.m_SpriteWeaponsMuzzles)
{
m_SpriteWeaponsMuzzle[i] = IGraphics::CTextureHandle();
SpriteWeaponsMuzzle[i] = IGraphics::CTextureHandle();
}
}
@ -2607,9 +2607,9 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTextureNew(m_GameSkin.m_SpritePickupGun);
Graphics()->UnloadTextureNew(m_GameSkin.m_SpritePickupHammer);
for(auto &m_SpritePickupWeapon : m_GameSkin.m_SpritePickupWeapons)
for(auto &SpritePickupWeapon : m_GameSkin.m_SpritePickupWeapons)
{
m_SpritePickupWeapon = IGraphics::CTextureHandle();
SpritePickupWeapon = IGraphics::CTextureHandle();
}
Graphics()->UnloadTextureNew(m_GameSkin.m_SpriteFlagBlue);
@ -2773,8 +2773,8 @@ void CGameClient::LoadEmoticonsSkin(const char *pPath, bool AsDir)
{
if(m_EmoticonsSkinLoaded)
{
for(auto &m_SpriteEmoticon : m_EmoticonsSkin.m_SpriteEmoticons)
Graphics()->UnloadTextureNew(m_SpriteEmoticon);
for(auto &SpriteEmoticon : m_EmoticonsSkin.m_SpriteEmoticons)
Graphics()->UnloadTextureNew(SpriteEmoticon);
m_EmoticonsSkinLoaded = false;
}
@ -2819,16 +2819,16 @@ void CGameClient::LoadParticlesSkin(const char *pPath, bool AsDir)
{
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleSlice);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleBall);
for(auto &i : m_ParticlesSkin.m_SpriteParticleSplat)
Graphics()->UnloadTextureNew(i);
for(auto &SpriteParticleSplat : m_ParticlesSkin.m_SpriteParticleSplat)
Graphics()->UnloadTextureNew(SpriteParticleSplat);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleSmoke);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleShell);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleExpl);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleAirJump);
Graphics()->UnloadTextureNew(m_ParticlesSkin.m_SpriteParticleHit);
for(auto &m_SpriteParticle : m_ParticlesSkin.m_SpriteParticles)
m_SpriteParticle = IGraphics::CTextureHandle();
for(auto &SpriteParticle : m_ParticlesSkin.m_SpriteParticles)
SpriteParticle = IGraphics::CTextureHandle();
m_ParticlesSkinLoaded = false;
}
@ -2886,14 +2886,14 @@ void CGameClient::LoadParticlesSkin(const char *pPath, bool AsDir)
void CGameClient::RefindSkins()
{
for(auto &m_aClient : m_aClients)
for(auto &Client : m_aClients)
{
if(m_aClient.m_aSkinName[0] != '\0')
if(Client.m_aSkinName[0] != '\0')
{
const CSkin *pSkin = m_pSkins->Get(m_pSkins->Find(m_aClient.m_aSkinName));
m_aClient.m_SkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
m_aClient.m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
m_aClient.UpdateRenderInfo();
const CSkin *pSkin = m_pSkins->Get(m_pSkins->Find(Client.m_aSkinName));
Client.m_SkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
Client.m_SkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
Client.UpdateRenderInfo();
}
}
m_pGhost->RefindSkin();

View file

@ -917,8 +917,8 @@ void CCharacter::DDRacePostCoreTick()
// handle Anti-Skip tiles
std::list<int> Indices = Collision()->GetMapIndices(m_PrevPos, m_Pos);
if(!Indices.empty())
for(int &Indice : Indices)
HandleTiles(Indice);
for(int Index : Indices)
HandleTiles(Index);
else
{
HandleTiles(CurrentIndex);

View file

@ -16,10 +16,10 @@
//////////////////////////////////////////////////
CGameWorld::CGameWorld()
{
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
m_apFirstEntityType = 0;
for(auto &m_apCharacter : m_apCharacters)
m_apCharacter = 0;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
pFirstEntityType = 0;
for(auto &pCharacter : m_apCharacters)
pCharacter = 0;
m_pCollision = 0;
m_GameTick = 0;
m_pParent = 0;
@ -29,9 +29,9 @@ CGameWorld::CGameWorld()
CGameWorld::~CGameWorld()
{
// delete all entities
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
while(m_apFirstEntityType)
delete m_apFirstEntityType;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
while(pFirstEntityType)
delete pFirstEntityType;
if(m_pChild && m_pChild->m_pParent == this)
{
OnModified();
@ -534,9 +534,9 @@ void CGameWorld::CopyWorld(CGameWorld *pFrom)
m_pTuningList = pFrom->m_pTuningList;
m_Teams = pFrom->m_Teams;
// delete the previous entities
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
while(m_apFirstEntityType)
delete m_apFirstEntityType;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
while(pFirstEntityType)
delete pFirstEntityType;
for(int i = 0; i < MAX_CLIENTS; i++)
{
m_apCharacters[i] = 0;
@ -594,7 +594,7 @@ void CGameWorld::OnModified()
void CGameWorld::Clear()
{
// delete all entities
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
while(m_apFirstEntityType)
delete m_apFirstEntityType;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
while(pFirstEntityType)
delete pFirstEntityType;
}

View file

@ -32,8 +32,8 @@ struct CSkin
m_FeetOutline = IGraphics::CTextureHandle();
m_Hands = IGraphics::CTextureHandle();
m_HandsOutline = IGraphics::CTextureHandle();
for(auto &m_Eye : m_Eyes)
m_Eye = IGraphics::CTextureHandle();
for(auto &Eye : m_Eyes)
Eye = IGraphics::CTextureHandle();
}
};

View file

@ -67,9 +67,9 @@ static const char *VANILLA_IMAGES[] = {
static bool IsVanillaImage(const char *pImage)
{
for(auto &i : VANILLA_IMAGES)
for(const auto *pVanillaImage : VANILLA_IMAGES)
{
if(str_comp(pImage, i) == 0)
if(str_comp(pImage, pVanillaImage) == 0)
{
return true;
}
@ -1687,10 +1687,10 @@ void CEditor::DoQuad(CQuad *q, int Index)
for(int i = 0; i < m_lSelectedQuads.size(); ++i)
{
CQuad *pCurrentQuad = &pLayer->m_lQuads[m_lSelectedQuads[i]];
for(auto &m_aPoint : pCurrentQuad->m_aPoints)
for(auto &Point : pCurrentQuad->m_aPoints)
{
m_aPoint.x += OffsetX;
m_aPoint.y += OffsetY;
Point.x += OffsetX;
Point.y += OffsetY;
}
}
}
@ -1702,10 +1702,10 @@ void CEditor::DoQuad(CQuad *q, int Index)
for(int i = 0; i < m_lSelectedQuads.size(); ++i)
{
CQuad *pCurrentQuad = &pLayer->m_lQuads[m_lSelectedQuads[i]];
for(auto &m_aPoint : pCurrentQuad->m_aPoints)
for(auto &Point : pCurrentQuad->m_aPoints)
{
m_aPoint.x += OffsetX;
m_aPoint.y += OffsetY;
Point.x += OffsetX;
Point.y += OffsetY;
}
}
}

View file

@ -915,10 +915,10 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
pTiles->m_pTiles[i].m_Index = 0;
for(int e : s_aTilesRep)
for(int TilesRep : s_aTilesRep)
{
if(((CLayerTele *)pTiles)->m_pTeleTile[i].m_Type == e)
pTiles->m_pTiles[i].m_Index = e;
if(((CLayerTele *)pTiles)->m_pTeleTile[i].m_Type == TilesRep)
pTiles->m_pTiles[i].m_Index = TilesRep;
}
}
}
@ -988,11 +988,11 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
continue;
}
for(int e : s_aTilesComp)
for(int TilesComp : s_aTilesComp)
{
if(pLayerSwitchTiles[i].m_Type == e)
if(pLayerSwitchTiles[i].m_Type == TilesComp)
{
pTiles->m_pTiles[i].m_Index = e;
pTiles->m_pTiles[i].m_Index = TilesComp;
pTiles->m_pTiles[i].m_Flags = pLayerSwitchTiles[i].m_Flags;
}
}

View file

@ -124,10 +124,10 @@ int CLayerQuads::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
CQuad n;
n = *q;
for(auto &m_aPoint : n.m_aPoints)
for(auto &Point : n.m_aPoints)
{
m_aPoint.x -= f2fx(Rect.x);
m_aPoint.y -= f2fx(Rect.y);
Point.x -= f2fx(Rect.x);
Point.y -= f2fx(Rect.y);
}
pGrabbed->m_lQuads.add(n);
@ -144,10 +144,10 @@ void CLayerQuads::BrushPlace(CLayer *pBrush, float wx, float wy)
{
CQuad n = l->m_lQuads[i];
for(auto &m_aPoint : n.m_aPoints)
for(auto &Point : n.m_aPoints)
{
m_aPoint.x += f2fx(wx);
m_aPoint.y += f2fx(wy);
Point.x += f2fx(wx);
Point.y += f2fx(wy);
}
m_lQuads.add(n);
@ -211,12 +211,12 @@ void CLayerQuads::BrushRotate(float Amount)
{
CQuad *q = &m_lQuads[i];
for(auto &m_aPoint : q->m_aPoints)
for(auto &Point : q->m_aPoints)
{
vec2 Pos(fx2f(m_aPoint.x), fx2f(m_aPoint.y));
vec2 Pos(fx2f(Point.x), fx2f(Point.y));
Rotate(&Center, &Pos, Amount);
m_aPoint.x = f2fx(Pos.x);
m_aPoint.y = f2fx(Pos.y);
Point.x = f2fx(Pos.x);
Point.y = f2fx(Pos.y);
}
}
}
@ -228,10 +228,10 @@ void CLayerQuads::GetSize(float *w, float *h)
for(int i = 0; i < m_lQuads.size(); i++)
{
for(auto &m_aPoint : m_lQuads[i].m_aPoints)
for(auto &Point : m_lQuads[i].m_aPoints)
{
*w = maximum(*w, fx2f(m_aPoint.x));
*h = maximum(*h, fx2f(m_aPoint.y));
*w = maximum(*w, fx2f(Point.x));
*h = maximum(*h, fx2f(Point.y));
}
}
}

View file

@ -638,13 +638,13 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View, void *pContext)
{
if(Prop == PROP_POS_X)
{
for(auto &m_aPoint : lQuads[i]->m_aPoints)
m_aPoint.x += OffsetX;
for(auto &Point : lQuads[i]->m_aPoints)
Point.x += OffsetX;
}
if(Prop == PROP_POS_Y)
{
for(auto &m_aPoint : lQuads[i]->m_aPoints)
m_aPoint.y += OffsetY;
for(auto &Point : lQuads[i]->m_aPoints)
Point.y += OffsetY;
}
if(Prop == PROP_POS_ENV)
{

View file

@ -50,11 +50,11 @@ CMapBugs GetMapBugs(const char *pName, int Size, SHA256_DIGEST Sha256)
CMapDescription Map = {pName, Size, Sha256};
CMapBugs Result;
Result.m_Extra = 0;
for(auto &i : MAP_BUGS)
for(auto &MapBug : MAP_BUGS)
{
if(Map == i.m_Map)
if(Map == MapBug.m_Map)
{
Result.m_pData = &i;
Result.m_pData = &MapBug;
return Result;
}
}

View file

@ -2259,9 +2259,9 @@ void CCharacter::DDRacePostCoreTick()
std::list<int> Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos);
if(!Indices.empty())
{
for(int &Indice : Indices)
for(int &Index : Indices)
{
HandleTiles(Indice);
HandleTiles(Index);
if(!m_Alive)
return;
}

View file

@ -21,9 +21,9 @@ CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW,
m_CaughtTeam = CaughtTeam;
GameWorld()->InsertEntity(this);
for(int &m_SoloID : m_SoloIDs)
for(int &SoloID : m_SoloIDs)
{
m_SoloID = -1;
SoloID = -1;
}
}
@ -84,10 +84,10 @@ void CDragger::Move()
if(m_Target)
{
for(auto &m_SoloEnt : m_SoloEnts)
for(auto &SoloEnt : m_SoloEnts)
{
if(m_SoloEnt == m_Target)
m_SoloEnt = 0;
if(SoloEnt == m_Target)
SoloEnt = 0;
}
}
}
@ -163,13 +163,13 @@ void CDragger::Snap(int SnappingClient)
CCharacter *Target = m_Target;
for(int &m_SoloID : m_SoloIDs)
for(int &SoloID : m_SoloIDs)
{
if(m_SoloID == -1)
if(SoloID == -1)
break;
Server()->SnapFreeID(m_SoloID);
m_SoloID = -1;
Server()->SnapFreeID(SoloID);
SoloID = -1;
}
int pos = 0;

View file

@ -37,8 +37,8 @@ void CGameContext::Construct(int Resetting)
m_Resetting = 0;
m_pServer = 0;
for(auto &m_apPlayer : m_apPlayers)
m_apPlayer = 0;
for(auto &pPlayer : m_apPlayers)
pPlayer = 0;
m_pController = 0;
m_VoteType = VOTE_TYPE_UNKNOWN;
@ -75,8 +75,8 @@ CGameContext::CGameContext()
CGameContext::~CGameContext()
{
for(auto &m_apPlayer : m_apPlayers)
delete m_apPlayer;
for(auto &pPlayer : m_apPlayers)
delete pPlayer;
if(!m_Resetting)
delete m_pVoteOptionHeap;
@ -142,10 +142,10 @@ void CGameContext::FillAntibot(CAntibotRoundData *pData)
for(int i = 0; i < MAX_CLIENTS; i++)
{
CAntibotCharacterData *pChar = &pData->m_aCharacters[i];
for(auto &m_aLatestInput : pChar->m_aLatestInputs)
for(auto &LatestInput : pChar->m_aLatestInputs)
{
m_aLatestInput.m_TargetX = -1;
m_aLatestInput.m_TargetY = -1;
LatestInput.m_TargetX = -1;
LatestInput.m_TargetY = -1;
}
pChar->m_Alive = false;
pChar->m_Pause = false;
@ -479,12 +479,12 @@ void CGameContext::SendBroadcast(const char *pText, int ClientID, bool IsImporta
dbg_assert(IsImportant, "broadcast messages to all players must be important");
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID);
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer)
if(pPlayer)
{
m_apPlayer->m_LastBroadcastImportance = true;
m_apPlayer->m_LastBroadcast = Server()->Tick();
pPlayer->m_LastBroadcastImportance = true;
pPlayer->m_LastBroadcast = Server()->Tick();
}
}
return;
@ -506,12 +506,12 @@ void CGameContext::StartVote(const char *pDesc, const char *pCommand, const char
// reset votes
m_VoteEnforce = VOTE_ENFORCE_UNKNOWN;
m_VoteEnforcer = -1;
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer)
if(pPlayer)
{
m_apPlayer->m_Vote = 0;
m_apPlayer->m_VotePos = 0;
pPlayer->m_Vote = 0;
pPlayer->m_VotePos = 0;
}
}
@ -784,10 +784,10 @@ void CGameContext::OnTick()
}
}
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer)
m_apPlayer->PostPostTick();
if(pPlayer)
pPlayer->PostPostTick();
}
// update voting
@ -1309,9 +1309,9 @@ void CGameContext::OnClientConnected(int ClientID)
{
{
bool Empty = true;
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer)
if(pPlayer)
{
Empty = false;
break;
@ -1379,17 +1379,17 @@ void CGameContext::OnClientDrop(int ClientID, const char *pReason)
m_VoteUpdate = true;
// update spectator modes
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer && m_apPlayer->m_SpectatorID == ClientID)
m_apPlayer->m_SpectatorID = SPEC_FREEVIEW;
if(pPlayer && pPlayer->m_SpectatorID == ClientID)
pPlayer->m_SpectatorID = SPEC_FREEVIEW;
}
// update conversation targets
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer && m_apPlayer->m_LastWhisperTo == ClientID)
m_apPlayer->m_LastWhisperTo = -1;
if(pPlayer && pPlayer->m_LastWhisperTo == ClientID)
pPlayer->m_LastWhisperTo = -1;
}
protocol7::CNetMsg_Sv_ClientDrop Msg;
@ -2688,9 +2688,9 @@ void CGameContext::ConSetTeamAll(IConsole::IResult *pResult, void *pUserData)
str_format(aBuf, sizeof(aBuf), "All players were moved to the %s", pSelf->m_pController->GetTeamName(Team));
pSelf->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
for(auto &m_apPlayer : pSelf->m_apPlayers)
if(m_apPlayer)
m_apPlayer->SetTeam(Team, false);
for(auto &pPlayer : pSelf->m_apPlayers)
if(pPlayer)
pPlayer->SetTeam(Team, false);
}
void CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData)
@ -2789,10 +2789,10 @@ void CGameContext::ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
pSelf->Server()->SendPackMsg(&VoteClearOptionsMsg, MSGFLAG_VITAL, -1);
// reset sending of vote options
for(auto &m_apPlayer : pSelf->m_apPlayers)
for(auto &pPlayer : pSelf->m_apPlayers)
{
if(m_apPlayer)
m_apPlayer->m_SendVoteIndex = 0;
if(pPlayer)
pPlayer->m_SendVoteIndex = 0;
}
// TODO: improve this
@ -2916,10 +2916,10 @@ void CGameContext::ConClearVotes(IConsole::IResult *pResult, void *pUserData)
pSelf->m_NumVoteOptions = 0;
// reset sending of vote options
for(auto &m_apPlayer : pSelf->m_apPlayers)
for(auto &pPlayer : pSelf->m_apPlayers)
{
if(m_apPlayer)
m_apPlayer->m_SendVoteIndex = 0;
if(pPlayer)
pPlayer->m_SendVoteIndex = 0;
}
}
@ -3567,10 +3567,10 @@ void CGameContext::OnSnap(int ClientID)
m_pController->Snap(ClientID);
m_Events.Snap(ClientID);
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer)
m_apPlayer->Snap(ClientID);
if(pPlayer)
pPlayer->Snap(ClientID);
}
if(ClientID > -1)
@ -4016,9 +4016,9 @@ int CGameContext::GetClientVersion(int ClientID)
bool CGameContext::PlayerModerating()
{
for(auto &m_apPlayer : m_apPlayers)
for(auto &pPlayer : m_apPlayers)
{
if(m_apPlayer && m_apPlayer->m_Moderating)
if(pPlayer && pPlayer->m_Moderating)
return true;
}
return false;

View file

@ -377,9 +377,9 @@ void IGameController::ChangeMap(const char *pToMap)
void IGameController::PostReset()
{
for(auto &m_apPlayer : GameServer()->m_apPlayers)
if(m_apPlayer)
m_apPlayer->Respawn();
for(auto &pPlayer : GameServer()->m_apPlayers)
if(pPlayer)
pPlayer->Respawn();
}
int IGameController::OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int Weapon)
@ -462,8 +462,8 @@ void IGameController::Tick()
{
// move player to spectator if the reserved slots aren't filled yet, kick him otherwise
int Spectators = 0;
for(auto &m_apPlayer : GameServer()->m_apPlayers)
if(m_apPlayer && m_apPlayer->GetTeam() == TEAM_SPECTATORS)
for(auto &pPlayer : GameServer()->m_apPlayers)
if(pPlayer && pPlayer->GetTeam() == TEAM_SPECTATORS)
++Spectators;
if(Spectators >= g_Config.m_SvSpectatorSlots)
Server()->Kick(i, "Kicked for inactivity");

View file

@ -18,16 +18,16 @@ CGameWorld::CGameWorld()
m_Paused = false;
m_ResetRequested = false;
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
m_apFirstEntityType = 0;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
pFirstEntityType = 0;
}
CGameWorld::~CGameWorld()
{
// delete all entities
for(auto &m_apFirstEntityType : m_apFirstEntityTypes)
while(m_apFirstEntityType)
delete m_apFirstEntityType;
for(auto &pFirstEntityType : m_apFirstEntityTypes)
while(pFirstEntityType)
delete pFirstEntityType;
}
void CGameWorld::SetGameServer(CGameContext *pGameServer)

View file

@ -655,10 +655,10 @@ void CPlayer::SetTeam(int Team, bool DoChatMsg)
if(Team == TEAM_SPECTATORS)
{
// update spectator modes
for(auto &m_apPlayer : GameServer()->m_apPlayers)
for(auto &pPlayer : GameServer()->m_apPlayers)
{
if(m_apPlayer && m_apPlayer->m_SpectatorID == m_ClientID)
m_apPlayer->m_SpectatorID = SPEC_FREEVIEW;
if(pPlayer && pPlayer->m_SpectatorID == m_ClientID)
pPlayer->m_SpectatorID = SPEC_FREEVIEW;
}
}
}
@ -931,19 +931,19 @@ void CPlayer::ProcessScoreResult(CScorePlayerResult &Result)
switch(Result.m_MessageKind)
{
case CScorePlayerResult::DIRECT:
for(auto &m_aaMessage : Result.m_Data.m_aaMessages)
for(auto &aMessage : Result.m_Data.m_aaMessages)
{
if(m_aaMessage[0] == 0)
if(aMessage[0] == 0)
break;
GameServer()->SendChatTarget(m_ClientID, m_aaMessage);
GameServer()->SendChatTarget(m_ClientID, aMessage);
}
break;
case CScorePlayerResult::ALL:
for(auto &m_aaMessage : Result.m_Data.m_aaMessages)
for(auto &aMessage : Result.m_Data.m_aaMessages)
{
if(m_aaMessage[0] == 0)
if(aMessage[0] == 0)
break;
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, m_aaMessage, m_ClientID);
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aMessage, m_ClientID);
}
break;
case CScorePlayerResult::BROADCAST:

View file

@ -30,8 +30,8 @@ void CScorePlayerResult::SetVariant(Variant v)
{
case DIRECT:
case ALL:
for(auto &m_aaMessage : m_Data.m_aaMessages)
m_aaMessage[0] = 0;
for(auto &aMessage : m_Data.m_aaMessages)
aMessage[0] = 0;
break;
case BROADCAST:
m_Data.m_Broadcast[0] = 0;
@ -46,16 +46,16 @@ void CScorePlayerResult::SetVariant(Variant v)
m_Data.m_Info.m_Birthday = 0;
m_Data.m_Info.m_HasFinishScore = false;
m_Data.m_Info.m_Time = 0;
for(float &i : m_Data.m_Info.m_CpTime)
i = 0;
for(float &CpTime : m_Data.m_Info.m_CpTime)
CpTime = 0;
}
}
CTeamrank::CTeamrank() :
m_NumNames(0)
{
for(auto &m_aaName : m_aaNames)
m_aaName[0] = '\0';
for(auto &aName : m_aaNames)
aName[0] = '\0';
mem_zero(&m_TeamID.m_aData, sizeof(m_TeamID));
}

View file

@ -129,8 +129,8 @@ public:
{
m_BestTime = 0;
m_CurrentTime = 0;
for(float &i : m_aBestCpTime)
i = 0;
for(float &BestCpTime : m_aBestCpTime)
BestCpTime = 0;
}
void Set(float Time, float CpTime[NUM_CHECKPOINTS])

View file

@ -48,10 +48,10 @@ void CTeeHistorian::Reset(const CGameInfo *pGameInfo, WRITE_CALLBACK pfnWriteCal
m_TickWritten = true;
m_MaxClientID = MAX_CLIENTS;
// `m_PrevMaxClientID` is initialized in `BeginTick`
for(auto &m_aPrevPlayer : m_aPrevPlayers)
for(auto &PrevPlayer : m_aPrevPlayers)
{
m_aPrevPlayer.m_Alive = false;
m_aPrevPlayer.m_InputExists = false;
PrevPlayer.m_Alive = false;
PrevPlayer.m_InputExists = false;
}
m_pfnWriteCallback = pfnWriteCallback;
m_pWriteCallbackUserdata = pUser;

View file

@ -58,15 +58,15 @@ void CTeeInfo::ToSixup()
}
// check for std skin
for(auto &g_StdSkin : g_StdSkins)
for(auto &StdSkin : g_StdSkins)
{
if(!str_comp(m_SkinName, g_StdSkin.m_SkinName))
if(!str_comp(m_SkinName, StdSkin.m_SkinName))
{
for(int p = 0; p < 6; p++)
{
str_copy(m_apSkinPartNames[p], g_StdSkin.m_apSkinPartNames[p], 24);
m_aUseCustomColors[p] = g_StdSkin.m_aUseCustomColors[p];
m_aSkinPartColors[p] = g_StdSkin.m_aSkinPartColors[p];
str_copy(m_apSkinPartNames[p], StdSkin.m_apSkinPartNames[p], 24);
m_aUseCustomColors[p] = StdSkin.m_aUseCustomColors[p];
m_aSkinPartColors[p] = StdSkin.m_aSkinPartColors[p];
}
break;
}
@ -98,12 +98,12 @@ void CTeeInfo::FromSixup()
m_ColorFeet = 0;
// check for std skin
for(auto &g_StdSkin : g_StdSkins)
for(auto &StdSkin : g_StdSkins)
{
bool match = true;
for(int p = 0; p < 6; p++)
{
if(str_comp(m_apSkinPartNames[p], g_StdSkin.m_apSkinPartNames[p]) || m_aUseCustomColors[p] != g_StdSkin.m_aUseCustomColors[p] || (m_aUseCustomColors[p] && m_aSkinPartColors[p] != g_StdSkin.m_aSkinPartColors[p]))
if(str_comp(m_apSkinPartNames[p], StdSkin.m_apSkinPartNames[p]) || m_aUseCustomColors[p] != StdSkin.m_aUseCustomColors[p] || (m_aUseCustomColors[p] && m_aSkinPartColors[p] != StdSkin.m_aSkinPartColors[p]))
{
match = false;
break;
@ -111,7 +111,7 @@ void CTeeInfo::FromSixup()
}
if(match)
{
str_copy(m_SkinName, g_StdSkin.m_SkinName, sizeof(m_SkinName));
str_copy(m_SkinName, StdSkin.m_SkinName, sizeof(m_SkinName));
return;
}
}

View file

@ -11,10 +11,10 @@ void Run(NETADDR Dest)
{
NETSOCKET aSockets[NUM_SOCKETS];
for(auto &aSocket : aSockets)
for(auto &Socket : aSockets)
{
NETADDR BindAddr = {NETTYPE_IPV4, {0}, 0};
aSocket = net_udp_create(BindAddr);
Socket = net_udp_create(BindAddr);
}
while(1)