Codechange: use EnumRange over many enum loops

This commit is contained in:
Peter Nelson
2026-06-13 21:54:42 +01:00
committed by Peter Nelson
parent c991564e12
commit c3b0d71973
67 changed files with 136 additions and 141 deletions
+3 -3
View File
@@ -121,7 +121,7 @@ uint16_t GroupStatistics::GetNumEngines(EngineID engine) const
{
/* Set up the engine count for all companies */
for (Company *c : Company::Iterate()) {
for (VehicleType type = VehicleType::Begin; type < VehicleType::CompanyEnd; type++) {
for (VehicleType type : EnumRange(VehicleType::CompanyEnd)) {
c->group_all[type].Clear();
c->group_default[type].Clear();
}
@@ -216,7 +216,7 @@ uint16_t GroupStatistics::GetNumEngines(EngineID engine) const
{
/* Set up the engine count for all companies */
for (Company *c : Company::Iterate()) {
for (VehicleType type = VehicleType::Begin; type < VehicleType::CompanyEnd; type++) {
for (VehicleType type : EnumRange(VehicleType::CompanyEnd)) {
c->group_all[type].ClearProfits();
c->group_default[type].ClearProfits();
}
@@ -243,7 +243,7 @@ uint16_t GroupStatistics::GetNumEngines(EngineID engine) const
{
/* Set up the engine count for all companies */
Company *c = Company::Get(company);
for (VehicleType type = VehicleType::Begin; type < VehicleType::CompanyEnd; type++) {
for (VehicleType type : EnumRange(VehicleType::CompanyEnd)) {
c->group_all[type].ClearAutoreplace();
c->group_default[type].ClearAutoreplace();
}