Codechange: Replace FOR_ALL_COMPANIES with range-based for loops

This commit is contained in:
glx
2019-12-14 17:22:38 +01:00
committed by Niels Martin Hansen
parent 68f22134cb
commit 3a14cea068
27 changed files with 87 additions and 165 deletions

View File

@@ -101,8 +101,7 @@ void GroupStatistics::Clear()
/* static */ void GroupStatistics::UpdateAfterLoad()
{
/* Set up the engine count for all companies */
Company *c;
FOR_ALL_COMPANIES(c) {
for (Company *c : Company::Iterate()) {
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
c->group_all[type].Clear();
c->group_default[type].Clear();
@@ -123,7 +122,7 @@ void GroupStatistics::Clear()
if (v->IsPrimaryVehicle()) GroupStatistics::CountVehicle(v, 1);
}
FOR_ALL_COMPANIES(c) {
for (const Company *c : Company::Iterate()) {
GroupStatistics::UpdateAutoreplace(c->index);
}
}
@@ -183,8 +182,7 @@ void GroupStatistics::Clear()
/* static */ void GroupStatistics::UpdateProfits()
{
/* Set up the engine count for all companies */
Company *c;
FOR_ALL_COMPANIES(c) {
for (Company *c : Company::Iterate()) {
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
c->group_all[type].ClearProfits();
c->group_default[type].ClearProfits();