Codechange: Replace network related FOR_ALL with range-based for loops

This commit is contained in:
glx
2019-12-16 20:56:10 +01:00
committed by Niels Martin Hansen
parent 09fa39c5b5
commit 41232f18c1
12 changed files with 89 additions and 191 deletions

View File

@@ -1234,8 +1234,7 @@ void NetworkClientsToSpectators(CompanyID cid)
/* If our company is changing owner, go to spectators */
if (cid == _local_company) SetLocalCompany(COMPANY_SPECTATOR);
NetworkClientInfo *ci;
FOR_ALL_CLIENT_INFOS(ci) {
for (NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {
if (ci->client_playas != cid) continue;
NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name);
ci->client_playas = COMPANY_SPECTATOR;
@@ -1299,8 +1298,7 @@ bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
/* Only companies actually playing can speak to team. Eg spectators cannot */
if (!_settings_client.gui.prefer_teamchat || !Company::IsValidID(cio->client_playas)) return false;
const NetworkClientInfo *ci;
FOR_ALL_CLIENT_INFOS(ci) {
for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {
if (ci->client_playas == cio->client_playas && ci != cio) return true;
}