1
0
Fork 0

Codechange: Use range-for when validating and finalising industries. (#11744)

pull/11747/head
Peter Nelson 2024-01-09 22:36:09 +00:00 committed by GitHub
parent 09eefd6e95
commit 8f2266f0ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -3433,8 +3433,8 @@ static bool ValidateIndustryLayout(const IndustryTileLayout &layout)
} }
bool have_regular_tile = false; bool have_regular_tile = false;
for (size_t i = 0; i < size; i++) { for (const auto &tilelayout : layout) {
if (layout[i].gfx != GFX_WATERTILE_SPECIALCHECK) { if (tilelayout.gfx != GFX_WATERTILE_SPECIALCHECK) {
have_regular_tile = true; have_regular_tile = true;
break; break;
} }
@ -9382,15 +9382,14 @@ static void FinaliseIndustriesArray()
} }
} }
for (uint j = 0; j < NUM_INDUSTRYTYPES; j++) { for (auto &indsp : _industry_specs) {
IndustrySpec *indsp = &_industry_specs[j]; if (indsp.enabled && indsp.grf_prop.grffile != nullptr) {
if (indsp->enabled && indsp->grf_prop.grffile != nullptr) { for (auto &conflicting : indsp.conflicting) {
for (uint i = 0; i < 3; i++) { conflicting = MapNewGRFIndustryType(conflicting, indsp.grf_prop.grffile->grfid);
indsp->conflicting[i] = MapNewGRFIndustryType(indsp->conflicting[i], indsp->grf_prop.grffile->grfid);
} }
} }
if (!indsp->enabled) { if (!indsp.enabled) {
indsp->name = STR_NEWGRF_INVALID_INDUSTRYTYPE; indsp.name = STR_NEWGRF_INVALID_INDUSTRYTYPE;
} }
} }
} }