Fix 9602de4: FinaliseCargoArray did nothing. (#11839)

`CargoSpec::Iterate()` deliberately skips invalid cargo types, but `FinaliseCargoCarry()` is only interested in them.
This commit is contained in:
Peter Nelson 2024-01-19 20:07:47 +00:00 committed by GitHub
parent db7697bcdf
commit 903119115b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -175,6 +175,7 @@ private:
static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs
friend void SetupCargoForClimate(LandscapeID l); friend void SetupCargoForClimate(LandscapeID l);
friend void FinaliseCargoArray();
}; };
extern CargoTypes _cargo_mask; extern CargoTypes _cargo_mask;

View File

@ -9174,13 +9174,13 @@ static void FinaliseEngineArray()
} }
/** Check for invalid cargoes */ /** Check for invalid cargoes */
static void FinaliseCargoArray() void FinaliseCargoArray()
{ {
for (CargoSpec *cs : CargoSpec::Iterate()) { for (CargoSpec &cs : CargoSpec::array) {
if (!cs->IsValid()) { if (!cs.IsValid()) {
cs->name = cs->name_single = cs->units_volume = STR_NEWGRF_INVALID_CARGO; cs.name = cs.name_single = cs.units_volume = STR_NEWGRF_INVALID_CARGO;
cs->quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY; cs.quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY;
cs->abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV; cs.abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV;
} }
} }
} }