1
0
Fork 0

Codechange: CargoSpec::Iterate already tests cargo validity. (#13941)

pull/13944/head
Peter Nelson 2025-04-01 18:23:26 +01:00 committed by GitHub
parent 8d0ba5649a
commit 2ae84f3c9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 4 deletions

View File

@ -2701,7 +2701,6 @@ static void ConDumpCargoTypes()
std::map<uint32_t, const GRFFile *> grfs;
for (const CargoSpec *spec : CargoSpec::Iterate()) {
if (!spec->IsValid()) continue;
uint32_t grfid = 0;
const GRFFile *grf = spec->grffile;
if (grf != nullptr) {

View File

@ -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.

View File

@ -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;