Optimize loops.

This commit is contained in:
momo5502 2016-01-24 19:58:13 +01:00
parent 0a68ff2dff
commit 388d5836cd
28 changed files with 81 additions and 81 deletions

View File

@ -30,7 +30,7 @@ namespace Components
void AssetHandler::ClearTemporaryAssets() void AssetHandler::ClearTemporaryAssets()
{ {
for (int i = 0; i < Game::XAssetType::ASSET_TYPE_COUNT; i++) for (int i = 0; i < Game::XAssetType::ASSET_TYPE_COUNT; ++i)
{ {
AssetHandler::TemporaryAssets[i].clear(); AssetHandler::TemporaryAssets[i].clear();
} }
@ -269,7 +269,7 @@ namespace Components
{ {
ClearTemporaryAssets(); ClearTemporaryAssets();
for (auto i = AssetHandler::AssetInterfaces.begin(); i != AssetHandler::AssetInterfaces.end(); i++) for (auto i = AssetHandler::AssetInterfaces.begin(); i != AssetHandler::AssetInterfaces.end(); ++i)
{ {
delete i->second; delete i->second;
} }

View File

@ -138,7 +138,7 @@ namespace Assets
if (asset->textureTable) if (asset->textureTable)
{ {
for (char i = 0; i < asset->textureCount; i++) for (char i = 0; i < asset->textureCount; ++i)
{ {
if (asset->textureTable[i].info.image) if (asset->textureTable[i].info.image)
{ {
@ -197,7 +197,7 @@ namespace Assets
Game::MaterialTextureDef* destTextureTable = buffer->Dest<Game::MaterialTextureDef>(); Game::MaterialTextureDef* destTextureTable = buffer->Dest<Game::MaterialTextureDef>();
buffer->SaveArray(asset->textureTable, asset->textureCount); buffer->SaveArray(asset->textureTable, asset->textureCount);
for (char i = 0; i < asset->textureCount; i++) for (char i = 0; i < asset->textureCount; ++i)
{ {
Game::MaterialTextureDef* destTextureDef = &destTextureTable[i]; Game::MaterialTextureDef* destTextureDef = &destTextureTable[i];
Game::MaterialTextureDef* textureDef = &asset->textureTable[i]; Game::MaterialTextureDef* textureDef = &asset->textureTable[i];

View File

@ -6,13 +6,13 @@ namespace Assets
{ {
Game::MaterialTechniqueSet* asset = header.materialTechset; Game::MaterialTechniqueSet* asset = header.materialTechset;
for (int i = 0; i < ARR_SIZE(Game::MaterialTechniqueSet::techniques); i++) for (int i = 0; i < ARR_SIZE(Game::MaterialTechniqueSet::techniques); ++i)
{ {
Game::MaterialTechnique* technique = asset->techniques[i]; Game::MaterialTechnique* technique = asset->techniques[i];
if (!technique) continue; if (!technique) continue;
for (short j = 0; j < technique->numPasses; j++) for (short j = 0; j < technique->numPasses; ++j)
{ {
Game::MaterialPass* pass = &technique->passes[j]; Game::MaterialPass* pass = &technique->passes[j];
@ -54,7 +54,7 @@ namespace Assets
// Save_MaterialTechniquePtrArray // Save_MaterialTechniquePtrArray
static_assert(ARR_SIZE(Game::MaterialTechniqueSet::techniques) == 48, "Techniques array invalid!"); static_assert(ARR_SIZE(Game::MaterialTechniqueSet::techniques) == 48, "Techniques array invalid!");
for (int i = 0; i < ARR_SIZE(Game::MaterialTechniqueSet::techniques); i++) for (int i = 0; i < ARR_SIZE(Game::MaterialTechniqueSet::techniques); ++i)
{ {
Game::MaterialTechnique* technique = asset->techniques[i]; Game::MaterialTechnique* technique = asset->techniques[i];
@ -74,7 +74,7 @@ namespace Assets
buffer->Save(technique, 8); buffer->Save(technique, 8);
// Save_MaterialPassArray // Save_MaterialPassArray
for (short j = 0; j < technique->numPasses; j++) for (short j = 0; j < technique->numPasses; ++j)
{ {
Assert_Size(Game::MaterialPass, 20); Assert_Size(Game::MaterialPass, 20);

View File

@ -48,7 +48,7 @@ namespace Components
if (maxclientCount) if (maxclientCount)
{ {
for (int i = 0; i < maxclientCount; i++) for (int i = 0; i < maxclientCount; ++i)
{ {
if (Game::svs_clients[i].state >= 3) if (Game::svs_clients[i].state >= 3)
{ {

View File

@ -109,7 +109,7 @@ namespace Components
{ {
// Rebuild map rotation string // Rebuild map rotation string
rotation.clear(); rotation.clear();
for (unsigned int j = (i + 2); j < tokens.size(); j++) for (unsigned int j = (i + 2); j < tokens.size(); ++j)
{ {
if (j != (i + 2)) rotation += " "; if (j != (i + 2)) rotation += " ";
rotation += tokens[j]; rotation += tokens[j];

View File

@ -32,7 +32,7 @@ namespace Components
void Download::RemoveClientDownload(int id) void Download::RemoveClientDownload(int id)
{ {
for (auto i = Download::DataContainer.ClientDownloads.begin(); i != Download::DataContainer.ClientDownloads.end(); i++) for (auto i = Download::DataContainer.ClientDownloads.begin(); i != Download::DataContainer.ClientDownloads.end(); ++i)
{ {
if (i->id == id) if (i->id == id)
{ {
@ -44,7 +44,7 @@ namespace Components
void Download::RemoveServerDownload(int id) void Download::RemoveServerDownload(int id)
{ {
for (auto i = Download::DataContainer.ServerDownloads.begin(); i != Download::DataContainer.ServerDownloads.end(); i++) for (auto i = Download::DataContainer.ServerDownloads.begin(); i != Download::DataContainer.ServerDownloads.end(); ++i)
{ {
if (i->id == id) if (i->id == id)
{ {
@ -71,7 +71,7 @@ namespace Components
{ {
if (download->parts.size()) if (download->parts.size())
{ {
for (auto i = download->parts.begin(); i != download->parts.end(); i++) for (auto i = download->parts.begin(); i != download->parts.end(); ++i)
{ {
if (i->first == packet) if (i->first == packet)
{ {
@ -85,7 +85,7 @@ namespace Components
bool Download::HasReceivedAllPackets(Download::Container::DownloadCL* download) bool Download::HasReceivedAllPackets(Download::Container::DownloadCL* download)
{ {
for (int i = 0; i < download->maxParts; i++) for (int i = 0; i < download->maxParts; ++i)
{ {
if (!Download::HasReceivedPacket(download, i)) if (!Download::HasReceivedPacket(download, i))
{ {
@ -216,7 +216,7 @@ namespace Components
download.lastPing = Game::Com_Milliseconds(); download.lastPing = Game::Com_Milliseconds();
download.maxParts = 0; download.maxParts = 0;
for (int i = 0; i < 1000000; i++) for (int i = 0; i < 1000000; ++i)
{ {
download.buffer.append("1234567890"); download.buffer.append("1234567890");
} }
@ -245,7 +245,7 @@ namespace Components
{ {
std::string buffer; std::string buffer;
for (int i = 0; i < download->maxParts; i++) for (int i = 0; i < download->maxParts; ++i)
{ {
if (!Download::HasReceivedPacket(download, i)) return ""; if (!Download::HasReceivedPacket(download, i)) return "";
buffer.append(download->parts[i]); buffer.append(download->parts[i]);
@ -276,7 +276,7 @@ namespace Components
{ {
if (download->sentParts.size()) if (download->sentParts.size())
{ {
for (auto i = download->sentParts.begin(); i != download->sentParts.end(); i++) for (auto i = download->sentParts.begin(); i != download->sentParts.end(); ++i)
{ {
if (*i == packet) if (*i == packet)
{ {
@ -315,7 +315,7 @@ namespace Components
{ {
if (Download::DataContainer.ClientDownloads.size()) if (Download::DataContainer.ClientDownloads.size())
{ {
for (auto i = Download::DataContainer.ClientDownloads.begin(); i != Download::DataContainer.ClientDownloads.end(); i++) for (auto i = Download::DataContainer.ClientDownloads.begin(); i != Download::DataContainer.ClientDownloads.end(); ++i)
{ {
if ((Game::Com_Milliseconds() - i->lastPing) > (DOWNLOAD_TIMEOUT * 2)) if ((Game::Com_Milliseconds() - i->lastPing) > (DOWNLOAD_TIMEOUT * 2))
{ {
@ -328,7 +328,7 @@ namespace Components
if (i->acknowledged && (Game::Com_Milliseconds() - i->lastPing) > DOWNLOAD_TIMEOUT) if (i->acknowledged && (Game::Com_Milliseconds() - i->lastPing) > DOWNLOAD_TIMEOUT)
{ {
std::vector<int> missingPackets; std::vector<int> missingPackets;
for (int j = 0; j < i->maxParts; j++) for (int j = 0; j < i->maxParts; ++j)
{ {
if (!Download::HasReceivedPacket(&*i, j)) if (!Download::HasReceivedPacket(&*i, j))
{ {
@ -343,7 +343,7 @@ namespace Components
if (Download::DataContainer.ServerDownloads.size()) if (Download::DataContainer.ServerDownloads.size())
{ {
for (auto i = Download::DataContainer.ServerDownloads.begin(); i != Download::DataContainer.ServerDownloads.end(); i++) for (auto i = Download::DataContainer.ServerDownloads.begin(); i != Download::DataContainer.ServerDownloads.end(); ++i)
{ {
if ((Game::Com_Milliseconds() - i->lastPing) > (DOWNLOAD_TIMEOUT * 3)) if ((Game::Com_Milliseconds() - i->lastPing) > (DOWNLOAD_TIMEOUT * 3))
{ {
@ -352,7 +352,7 @@ namespace Components
} }
int packets = 0; int packets = 0;
for (int j = 0; j < i->maxParts && packets <= FRAME_PACKET_LIMIT && i->acknowledged; j++) for (int j = 0; j < i->maxParts && packets <= FRAME_PACKET_LIMIT && i->acknowledged; ++j)
{ {
if (!Download::HasSentPacket(&*i, j)) if (!Download::HasSentPacket(&*i, j))
{ {

View File

@ -53,7 +53,7 @@ namespace Components
if (files) if (files)
{ {
for (int i = 0; i < numFiles; i++) for (int i = 0; i < numFiles; ++i)
{ {
if (files[i]) if (files[i])
{ {

View File

@ -23,7 +23,7 @@ namespace Components
LPCWSTR commandLine = GetCommandLineW(); LPCWSTR commandLine = GetCommandLineW();
LPWSTR* argv = CommandLineToArgvW(commandLine, &numArgs); LPWSTR* argv = CommandLineToArgvW(commandLine, &numArgs);
for (int i = 0; i < numArgs;i++) for (int i = 0; i < numArgs; ++i)
{ {
std::wstring wFlag = argv[i]; std::wstring wFlag = argv[i];
if (wFlag[0] == L'-') if (wFlag[0] == L'-')

View File

@ -88,7 +88,7 @@ namespace Components
void Localization::ClearTemp() void Localization::ClearTemp()
{ {
for (auto i = Localization::TempLocalizeMap.begin(); i != Localization::TempLocalizeMap.end(); i++) for (auto i = Localization::TempLocalizeMap.begin(); i != Localization::TempLocalizeMap.end(); ++i)
{ {
if (i->second) if (i->second)
{ {
@ -175,7 +175,7 @@ namespace Components
{ {
Localization::ClearTemp(); Localization::ClearTemp();
for (auto i = Localization::LocalizeMap.begin(); i != Localization::LocalizeMap.end(); i++) for (auto i = Localization::LocalizeMap.begin(); i != Localization::LocalizeMap.end(); ++i)
{ {
if (i->second) if (i->second)
{ {

View File

@ -64,7 +64,7 @@ namespace Components
{ {
Logger::MessageMutex.lock(); Logger::MessageMutex.lock();
for (unsigned int i = 0; i < Logger::MessageQueue.size(); i++) for (unsigned int i = 0; i < Logger::MessageQueue.size(); ++i)
{ {
if (Logger::IsConsoleReady()) if (Logger::IsConsoleReady())
{ {

View File

@ -15,7 +15,7 @@ namespace Components
if (!zoneInfo) return; if (!zoneInfo) return;
Maps::CurrentDependencies.clear(); Maps::CurrentDependencies.clear();
for (auto i = Maps::DependencyList.begin(); i != Maps::DependencyList.end(); i++) for (auto i = Maps::DependencyList.begin(); i != Maps::DependencyList.end(); ++i)
{ {
if (std::regex_match(zoneInfo->name, std::regex(i->first))) if (std::regex_match(zoneInfo->name, std::regex(i->first)))
{ {
@ -29,7 +29,7 @@ namespace Components
std::vector<Game::XZoneInfo> data; std::vector<Game::XZoneInfo> data;
Utils::Merge(&data, zoneInfo, zoneCount); Utils::Merge(&data, zoneInfo, zoneCount);
for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); i++) for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); ++i)
{ {
Game::XZoneInfo info; Game::XZoneInfo info;

View File

@ -10,7 +10,7 @@ namespace Components
{ {
// Check if a free slot is available // Check if a free slot is available
int i = 1; int i = 1;
for (; i < MAX_SOURCEFILES; i++) for (; i < MAX_SOURCEFILES; ++i)
{ {
if (!Game::sourceFiles[i]) if (!Game::sourceFiles[i])
break; break;
@ -273,7 +273,7 @@ namespace Components
{ {
std::vector<Game::menuDef_t*> menus; std::vector<Game::menuDef_t*> menus;
for (int i = 0; i < menuList->menuCount; i++) for (int i = 0; i < menuList->menuCount; ++i)
{ {
if (!menuList->menus[i]) if (!menuList->menus[i])
{ {
@ -372,7 +372,7 @@ namespace Components
// Seems like this is obsolete as well, // Seems like this is obsolete as well,
// as the game handles the memory // as the game handles the memory
//for (int i = 0; i < menudef->itemCount; i++) //for (int i = 0; i < menudef->itemCount; ++i)
//{ //{
// Game::Menu_FreeItemMemory(menudef->items[i]); // Game::Menu_FreeItemMemory(menudef->items[i]);
//} //}
@ -415,7 +415,7 @@ namespace Components
void Menus::RemoveMenu(Game::menuDef_t* menudef) void Menus::RemoveMenu(Game::menuDef_t* menudef)
{ {
for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end(); i++) for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end(); ++i)
{ {
if (i->second == menudef) if (i->second == menudef)
{ {
@ -433,7 +433,7 @@ namespace Components
{ {
if (i->second) if (i->second)
{ {
for (auto j = 0; j < i->second->menuCount; j++) for (auto j = 0; j < i->second->menuCount; ++j)
{ {
Menus::RemoveMenu(i->second->menus[j]); Menus::RemoveMenu(i->second->menus[j]);
} }
@ -465,7 +465,7 @@ namespace Components
Game::menuDef_t* oldMenu = i->second; Game::menuDef_t* oldMenu = i->second;
// Replace every old instance with our new one in the ui context // Replace every old instance with our new one in the ui context
for (int j = 0; j < Game::uiContext->menuCount; j++) for (int j = 0; j < Game::uiContext->menuCount; ++j)
{ {
if (Game::uiContext->menus[j] == oldMenu) if (Game::uiContext->menus[j] == oldMenu)
{ {
@ -474,13 +474,13 @@ namespace Components
} }
// Replace every old instance with our new one in our menu lists // Replace every old instance with our new one in our menu lists
for (auto j = Menus::MenuListList.begin(); j != Menus::MenuListList.end(); j++) for (auto j = Menus::MenuListList.begin(); j != Menus::MenuListList.end(); ++j)
{ {
Game::MenuList* list = j->second; Game::MenuList* list = j->second;
if (list && list->menus) if (list && list->menus)
{ {
for (int k = 0; k < list->menuCount; k++) for (int k = 0; k < list->menuCount; ++k)
{ {
if (list->menus[k] == oldMenu) if (list->menus[k] == oldMenu)
{ {
@ -500,14 +500,14 @@ namespace Components
void Menus::FreeEverything() void Menus::FreeEverything()
{ {
for (auto i = Menus::MenuListList.begin(); i != Menus::MenuListList.end(); i++) for (auto i = Menus::MenuListList.begin(); i != Menus::MenuListList.end(); ++i)
{ {
Menus::FreeMenuList(i->second); Menus::FreeMenuList(i->second);
} }
Menus::MenuListList.clear(); Menus::MenuListList.clear();
for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end(); i++) for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end(); ++i)
{ {
Menus::FreeMenu(i->second); Menus::FreeMenu(i->second);
} }
@ -532,7 +532,7 @@ namespace Components
{ {
Game::MenuList* list = Menus::MenuListList[filename]; Game::MenuList* list = Menus::MenuListList[filename];
for (int i = 0; list && list->menus && i < list->menuCount; i++) for (int i = 0; list && list->menus && i < list->menuCount; ++i)
{ {
Menus::RemoveMenuFromContext(Game::uiContext, list->menus[i]); Menus::RemoveMenuFromContext(Game::uiContext, list->menus[i]);
} }
@ -592,7 +592,7 @@ namespace Components
{ {
// Search menu in context // Search menu in context
int i = 0; int i = 0;
for (; i < dc->menuCount; i++) for (; i < dc->menuCount; ++i)
{ {
if (dc->menus[i] == menu) if (dc->menus[i] == menu)
{ {
@ -603,7 +603,7 @@ namespace Components
// Remove from stack // Remove from stack
if (i < dc->menuCount) if (i < dc->menuCount)
{ {
for (; i < dc->menuCount - 1; i++) for (; i < dc->menuCount - 1; ++i)
{ {
dc->menus[i] = dc->menus[i + 1]; dc->menus[i] = dc->menus[i + 1];
} }

View File

@ -71,7 +71,7 @@ namespace Components
if (Game::NET_IsLocalAddress(this->address)) return true; // Loopback if (Game::NET_IsLocalAddress(this->address)) return true; // Loopback
if (this->GetPort() != (Dvar::Var("net_port").Get<int>() & 0xFFFF)) return false; // Port not equal if (this->GetPort() != (Dvar::Var("net_port").Get<int>() & 0xFFFF)) return false; // Port not equal
for (int i = 0; i < *Game::numIP; i++) for (int i = 0; i < *Game::numIP; ++i)
{ {
if (this->GetIP().full == Game::localIP[i].full) if (this->GetIP().full == Game::localIP[i].full)
{ {
@ -129,7 +129,7 @@ namespace Components
void Network::BroadcastRange(unsigned int min, unsigned int max, std::string data) void Network::BroadcastRange(unsigned int min, unsigned int max, std::string data)
{ {
for (unsigned int i = min; i < max; i++) for (unsigned int i = min; i < max; ++i)
{ {
Network::Broadcast(static_cast<unsigned short>(i & 0xFFFF), data); Network::Broadcast(static_cast<unsigned short>(i & 0xFFFF), data);
} }
@ -152,7 +152,7 @@ namespace Components
packetCommand = Utils::StrToLower(packetCommand); packetCommand = Utils::StrToLower(packetCommand);
// Check if custom handler exists // Check if custom handler exists
for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); i++) for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); ++i)
{ {
if (Utils::StrToLower(i->first) == packetCommand) if (Utils::StrToLower(i->first) == packetCommand)
{ {

View File

@ -249,7 +249,7 @@ namespace Components
if (maxclientCount) if (maxclientCount)
{ {
for (int i = 0; i < maxclientCount; i++) for (int i = 0; i < maxclientCount; ++i)
{ {
if (Game::svs_clients[i].state >= 3) if (Game::svs_clients[i].state >= 3)
{ {

View File

@ -19,7 +19,7 @@ namespace Components
if (challengeTable) if (challengeTable)
{ {
for (int i = 0; i < challengeTable->rowCount; i++) for (int i = 0; i < challengeTable->rowCount; ++i)
{ {
// Find challenge // Find challenge
const char* challenge = Game::TabeLookup(challengeTable, i, 0); const char* challenge = Game::TabeLookup(challengeTable, i, 0);
@ -28,7 +28,7 @@ namespace Components
int maxProgress = 0; int maxProgress = 0;
// Find correct tier and progress // Find correct tier and progress
for (int j = 0; j < 10; j++) for (int j = 0; j < 10; ++j)
{ {
int progress = atoi(Game::TabeLookup(challengeTable, i, 6 + j * 2)); int progress = atoi(Game::TabeLookup(challengeTable, i, 6 + j * 2));
if (!progress )break; if (!progress )break;

View File

@ -131,7 +131,7 @@ namespace Components
std::string playerList; std::string playerList;
for (int i = 0; i < maxclientCount; i++) // Maybe choose 18 here? for (int i = 0; i < maxclientCount; ++i) // Maybe choose 18 here?
{ {
int score = 0; int score = 0;
int ping = 0; int ping = 0;
@ -205,7 +205,7 @@ namespace Components
if (lines.size() <= 1) return; if (lines.size() <= 1) return;
for (unsigned int i = 1; i < lines.size(); i++) for (unsigned int i = 1; i < lines.size(); ++i)
{ {
ServerInfo::Container::Player player; ServerInfo::Container::Player player;

View File

@ -159,7 +159,7 @@ namespace Components
int ui_browserMod = Dvar::Var("ui_browserMod").Get<int>(); int ui_browserMod = Dvar::Var("ui_browserMod").Get<int>();
int ui_joinGametype = Dvar::Var("ui_joinGametype").Get<int>(); int ui_joinGametype = Dvar::Var("ui_joinGametype").Get<int>();
for (unsigned int i = 0; i < list->size(); i++) for (unsigned int i = 0; i < list->size(); ++i)
{ {
ServerList::ServerInfo* info = &(*list)[i]; ServerList::ServerInfo* info = &(*list)[i];
@ -251,7 +251,7 @@ namespace Components
auto storedServers = object.array_items(); auto storedServers = object.array_items();
for (unsigned int i = 0; i < storedServers.size(); i++) for (unsigned int i = 0; i < storedServers.size(); ++i)
{ {
if (!storedServers[i].is_string()) continue; if (!storedServers[i].is_string()) continue;
if (storedServers[i].string_value() == server) if (storedServers[i].string_value() == server)
@ -290,7 +290,7 @@ namespace Components
auto servers = object.array_items(); auto servers = object.array_items();
for (unsigned int i = 0; i < servers.size(); i++) for (unsigned int i = 0; i < servers.size(); ++i)
{ {
if(!servers[i].is_string()) continue; if(!servers[i].is_string()) continue;
ServerList::InsertRequest(servers[i].string_value(), true); ServerList::InsertRequest(servers[i].string_value(), true);
@ -329,7 +329,7 @@ namespace Components
{ {
ServerList::RefreshContainer.Mutex.lock(); ServerList::RefreshContainer.Mutex.lock();
for (auto i = ServerList::RefreshContainer.Servers.begin(); i != ServerList::RefreshContainer.Servers.end(); i++) for (auto i = ServerList::RefreshContainer.Servers.begin(); i != ServerList::RefreshContainer.Servers.end(); ++i)
{ {
// Our desired server // Our desired server
if (i->Target == address && i->Sent) if (i->Target == address && i->Sent)
@ -365,7 +365,7 @@ namespace Components
if (!list) return; if (!list) return;
unsigned int k = 0; unsigned int k = 0;
for (auto j = list->begin(); j != list->end(); j++, k++) for (auto j = list->begin(); j != list->end(); ++j, ++k)
{ {
if (j->Addr == address) if (j->Addr == address)
{ {
@ -375,7 +375,7 @@ namespace Components
} }
// Also remove from visible list // Also remove from visible list
for (auto j = ServerList::VisibleList.begin(); j != ServerList::VisibleList.end(); j++) for (auto j = ServerList::VisibleList.begin(); j != ServerList::VisibleList.end(); ++j)
{ {
if (*j == k) if (*j == k)
{ {
@ -477,7 +477,7 @@ namespace Components
// Send requests to 10 servers each frame // Send requests to 10 servers each frame
int SendServers = 10; int SendServers = 10;
for (unsigned int i = 0; i < ServerList::RefreshContainer.Servers.size(); i++) for (unsigned int i = 0; i < ServerList::RefreshContainer.Servers.size(); ++i)
{ {
ServerList::Container::ServerContainer* server = &ServerList::RefreshContainer.Servers[i]; ServerList::Container::ServerContainer* server = &ServerList::RefreshContainer.Servers[i];
if (server->Sent) continue; if (server->Sent) continue;
@ -566,7 +566,7 @@ namespace Components
} }
while (!entry->HasSeparator() && !entry->IsEndToken()); while (!entry->HasSeparator() && !entry->IsEndToken());
for (int i = 0; !entry[i].IsEndToken() && entry[i].HasSeparator(); i++) for (int i = 0; !entry[i].IsEndToken() && entry[i].HasSeparator(); ++i)
{ {
Network::Address serverAddr = address; Network::Address serverAddr = address;
serverAddr.SetIP(entry[i].IP); serverAddr.SetIP(entry[i].IP);

View File

@ -43,9 +43,9 @@ namespace Components
return nullptr; return nullptr;
} }
for (int i = 0; i < table->rowCount; i++) for (int i = 0; i < table->rowCount; ++i)
{ {
for (int j = 0; j < table->columnCount; j++) for (int j = 0; j < table->columnCount; ++j)
{ {
Game::StringTableCell* cell = &table->values[i * table->columnCount + j]; Game::StringTableCell* cell = &table->values[i * table->columnCount + j];
cell->hash = StringTable::Hash(parsedTable.GetElementAt(i, j).data()); cell->hash = StringTable::Hash(parsedTable.GetElementAt(i, j).data());
@ -90,14 +90,14 @@ namespace Components
StringTable::~StringTable() StringTable::~StringTable()
{ {
for (auto i = StringTable::StringTableMap.begin(); i != StringTable::StringTableMap.end(); i++) for (auto i = StringTable::StringTableMap.begin(); i != StringTable::StringTableMap.end(); ++i)
{ {
Game::StringTable* table = i->second; Game::StringTable* table = i->second;
if (table) if (table)
{ {
if (table->values) if (table->values)
{ {
for (int j = 0; j < table->rowCount * table->columnCount; j++) for (int j = 0; j < table->rowCount * table->columnCount; ++j)
{ {
if (table->values[j].string) if (table->values[j].string)
{ {

View File

@ -297,7 +297,7 @@ namespace Components
int numDel = files.size() - Dvar::Var("cl_demosKeep").Get<int>(); int numDel = files.size() - Dvar::Var("cl_demosKeep").Get<int>();
for (int i = 0; i < numDel; i++) for (int i = 0; i < numDel; ++i)
{ {
Logger::Print("Deleting old demo %s\n", files[i].data()); Logger::Print("Deleting old demo %s\n", files[i].data());
FileSystem::DeleteFile("demos", files[i].data()); FileSystem::DeleteFile("demos", files[i].data());

View File

@ -78,7 +78,7 @@ namespace Components
{ {
if (key == 200 || key == 201) //mouse buttons if (key == 200 || key == 201) //mouse buttons
{ {
for (auto i = UIScript::UIOwnerDraws.begin(); i != UIScript::UIOwnerDraws.end(); i++) for (auto i = UIScript::UIOwnerDraws.begin(); i != UIScript::UIOwnerDraws.end(); ++i)
{ {
if (i->first == ownerDraw) if (i->first == ownerDraw)
{ {

View File

@ -52,7 +52,7 @@ namespace Components
void ZoneBuilder::Zone::LoadFastFiles() void ZoneBuilder::Zone::LoadFastFiles()
{ {
Logger::Print("Loading required FastFiles...\n"); Logger::Print("Loading required FastFiles...\n");
for (int i = 0; i < DataMap.GetRows(); i++) for (int i = 0; i < DataMap.GetRows(); ++i)
{ {
if (DataMap.GetElementAt(i, 0) == "require") if (DataMap.GetElementAt(i, 0) == "require")
{ {
@ -81,7 +81,7 @@ namespace Components
bool ZoneBuilder::Zone::LoadAssets() bool ZoneBuilder::Zone::LoadAssets()
{ {
for (int i = 0; i < DataMap.GetRows(); i++) for (int i = 0; i < DataMap.GetRows(); ++i)
{ {
if (DataMap.GetElementAt(i, 0) != "require") if (DataMap.GetElementAt(i, 0) != "require")
{ {
@ -145,7 +145,7 @@ namespace Components
int ZoneBuilder::Zone::FindAsset(Game::XAssetType type, std::string name) int ZoneBuilder::Zone::FindAsset(Game::XAssetType type, std::string name)
{ {
for (unsigned int i = 0; i < ZoneBuilder::Zone::LoadedAssets.size(); i++) for (unsigned int i = 0; i < ZoneBuilder::Zone::LoadedAssets.size(); ++i)
{ {
Game::XAsset* asset = &ZoneBuilder::Zone::LoadedAssets[i]; Game::XAsset* asset = &ZoneBuilder::Zone::LoadedAssets[i];
@ -247,7 +247,7 @@ namespace Components
// That's the reason why the count is incremented by 1, if scriptStrings are available. // That's the reason why the count is incremented by 1, if scriptStrings are available.
// Write ScriptString pointer table // Write ScriptString pointer table
for (size_t i = 0; i < ZoneBuilder::Zone::ScriptStrings.size(); i++) for (size_t i = 0; i < ZoneBuilder::Zone::ScriptStrings.size(); ++i)
{ {
ZoneBuilder::Zone::Buffer.SaveMax(4); ZoneBuilder::Zone::Buffer.SaveMax(4);
} }
@ -293,7 +293,7 @@ namespace Components
header->externalSize = 0; // ? header->externalSize = 0; // ?
// Write stream sizes // Write stream sizes
for (int i = 0; i < Game::MAX_XFILE_COUNT; i++) for (int i = 0; i < Game::MAX_XFILE_COUNT; ++i)
{ {
header->blockSize[i] = ZoneBuilder::Zone::Buffer.GetBlockSize((Game::XFILE_BLOCK_TYPES)i); header->blockSize[i] = ZoneBuilder::Zone::Buffer.GetBlockSize((Game::XFILE_BLOCK_TYPES)i);
} }

View File

@ -207,7 +207,7 @@ namespace Game
const char* UI_LocalizeMapName(const char* mapName) const char* UI_LocalizeMapName(const char* mapName)
{ {
for (int i = 0; i < *arenaCount; i++) for (int i = 0; i < *arenaCount; ++i)
{ {
if (!_stricmp(arenas[i].mapName, mapName)) if (!_stricmp(arenas[i].mapName, mapName))
{ {
@ -232,7 +232,7 @@ namespace Game
return ""; return "";
} }
for (int i = 0; i < *gameTypeCount; i++) for (int i = 0; i < *gameTypeCount; ++i)
{ {
if (!_stricmp(gameTypes[i].gameType, gameType)) if (!_stricmp(gameTypes[i].gameType, gameType))
{ {
@ -252,7 +252,7 @@ namespace Game
XAssetType DB_GetXAssetNameType(const char* name) XAssetType DB_GetXAssetNameType(const char* name)
{ {
for (int i = 0; i < ASSET_TYPE_COUNT; i++) for (int i = 0; i < ASSET_TYPE_COUNT; ++i)
{ {
XAssetType type = static_cast<XAssetType>(i); XAssetType type = static_cast<XAssetType>(i);
if (!_stricmp(DB_GetXAssetTypeName(type), name)) if (!_stricmp(DB_GetXAssetTypeName(type), name))

View File

@ -41,7 +41,7 @@ namespace Utils
{ {
int count = 0; int count = 0;
for (int i = 0; i < CSV::GetRows(); i++) for (int i = 0; i < CSV::GetRows(); ++i)
{ {
count = max(CSV::GetColumns(i), count); count = max(CSV::GetColumns(i), count);
} }
@ -96,7 +96,7 @@ namespace Utils
std::vector<std::string> _row; std::vector<std::string> _row;
char tempStr = 0; char tempStr = 0;
for (unsigned int i = 0; i < row.size(); i++) for (unsigned int i = 0; i < row.size(); ++i)
{ {
if (row[i] == ',' && !isString) // FLush entry if (row[i] == ',' && !isString) // FLush entry
{ {

View File

@ -15,7 +15,7 @@ namespace Utils
} }
~Allocator() ~Allocator()
{ {
for (auto i = this->RefMemory.begin(); i != this->RefMemory.end(); i++) for (auto i = this->RefMemory.begin(); i != this->RefMemory.end(); ++i)
{ {
if (i->first && i->second) if (i->first && i->second)
{ {

View File

@ -67,7 +67,7 @@ namespace Utils
{ {
auto ret = Stream::Length(); auto ret = Stream::Length();
for (size_t i = 0; i < count; i++) for (size_t i = 0; i < count; ++i)
{ {
Stream::Save(stream, &value, 4, 1); Stream::Save(stream, &value, 4, 1);
} }
@ -108,7 +108,7 @@ namespace Utils
{ {
auto ret = Stream::Length(); auto ret = Stream::Length();
for (size_t i = 0; i < count; i++) for (size_t i = 0; i < count; ++i)
{ {
Stream::Save(&byte, 1); Stream::Save(&byte, 1);
} }

View File

@ -191,7 +191,7 @@ namespace Utils
bool first = true; bool first = true;
for (auto i = this->KeyValuePairs.begin(); i != this->KeyValuePairs.end(); i++) for (auto i = this->KeyValuePairs.begin(); i != this->KeyValuePairs.end(); ++i)
{ {
if (first) first = false; if (first) first = false;
else infoString.append("\\"); else infoString.append("\\");
@ -206,7 +206,7 @@ namespace Utils
void InfoString::Dump() void InfoString::Dump()
{ {
for (auto i = this->KeyValuePairs.begin(); i != this->KeyValuePairs.end(); i++) for (auto i = this->KeyValuePairs.begin(); i != this->KeyValuePairs.end(); ++i)
{ {
OutputDebugStringA(Utils::VA("%s: %s", i->first.data(), i->second.data())); OutputDebugStringA(Utils::VA("%s: %s", i->first.data(), i->second.data()));
} }

View File

@ -43,7 +43,7 @@ namespace Utils
{ {
if (source) if (source)
{ {
for (size_t i = 0; i < length; i++) for (size_t i = 0; i < length; ++i)
{ {
target->push_back(source[i]); target->push_back(source[i]);
} }

View File

@ -61,7 +61,7 @@ namespace Utils
// Parse protocol // Parse protocol
if (pURL.cchProtocol && pURL.cchProtocol != 0xCCCCCCCC && pURL.pszProtocol) if (pURL.cchProtocol && pURL.cchProtocol != 0xCCCCCCCC && pURL.pszProtocol)
{ {
for (UINT i = 0; i < pURL.cchProtocol; i++) for (UINT i = 0; i < pURL.cchProtocol; ++i)
{ {
char lChar = static_cast<char>(tolower(pURL.pszProtocol[i])); char lChar = static_cast<char>(tolower(pURL.pszProtocol[i]));
WebIO::m_sUrl.protocol.append(&lChar, 1); WebIO::m_sUrl.protocol.append(&lChar, 1);
@ -116,7 +116,7 @@ namespace Utils
{ {
std::string body; std::string body;
for (auto param = params.begin(); param != params.end(); param++) for (auto param = params.begin(); param != params.end(); ++param)
{ {
std::string key = param->first; std::string key = param->first;
std::string value = param->second; std::string value = param->second;