From 2ae84f3c9eb49488298dc3b0e8e079a1ee84ffb3 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 1 Apr 2025 18:23:26 +0100 Subject: [PATCH] Codechange: CargoSpec::Iterate already tests cargo validity. (#13941) --- src/console_cmds.cpp | 1 - src/industry_gui.cpp | 1 - src/newgrf.cpp | 2 -- 3 files changed, 4 deletions(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 6f4b9cf5d7..23b2dabf5d 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -2701,7 +2701,6 @@ static void ConDumpCargoTypes() std::map grfs; for (const CargoSpec *spec : CargoSpec::Iterate()) { - if (!spec->IsValid()) continue; uint32_t grfid = 0; const GRFFile *grf = spec->grffile; if (grf != nullptr) { diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 9c3b4ac7dc..651dac4014 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -2619,7 +2619,6 @@ struct IndustryCargoesWindow : public Window { this->cargo_textsize.width = 0; this->cargo_textsize.height = 0; for (const CargoSpec *csp : CargoSpec::Iterate()) { - if (!csp->IsValid()) continue; this->cargo_textsize = maxdim(this->cargo_textsize, GetStringBoundingBox(csp->name)); } d = maxdim(d, this->cargo_textsize); // Box must also be wide enough to hold any cargo label. diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 0d198abd97..7c14928895 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -528,8 +528,6 @@ static void BuildCargoTranslationMap() auto cargo_list = GetCargoTranslationTable(*_cur.grffile); for (const CargoSpec *cs : CargoSpec::Iterate()) { - if (!cs->IsValid()) continue; - /* Check the translation table for this cargo's label */ int idx = find_index(cargo_list, cs->label); if (idx >= 0) _cur.grffile->cargo_map[cs->Index()] = idx;