Codechange: Use iterators and/or range-for on cargo related loops.

This commit is contained in:
Peter Nelson
2023-10-18 20:49:01 +01:00
committed by Peter Nelson
parent 2a88e0fab3
commit 9602de474d
16 changed files with 79 additions and 89 deletions

View File

@@ -2566,8 +2566,7 @@ struct IndustryCargoesWindow : public Window {
/* Compute max size of the cargo texts. */
this->cargo_textsize.width = 0;
this->cargo_textsize.height = 0;
for (uint i = 0; i < NUM_CARGO; i++) {
const CargoSpec *csp = CargoSpec::Get(i);
for (const CargoSpec *csp : CargoSpec::Iterate()) {
if (!csp->IsValid()) continue;
this->cargo_textsize = maxdim(this->cargo_textsize, GetStringBoundingBox(csp->name));
}