# HG changeset patch # User Peter Nelson # Date 2024-01-19 20:07:47 # Node ID 3caca0eb645589e408ded4b248b712c983c73688 # Parent 07f22f1d3a75099c16b116bb77b0e21426027288 Fix 9602de4: FinaliseCargoArray did nothing. (#11839) `CargoSpec::Iterate()` deliberately skips invalid cargo types, but `FinaliseCargoCarry()` is only interested in them. diff --git a/src/cargotype.h b/src/cargotype.h --- a/src/cargotype.h +++ b/src/cargotype.h @@ -175,6 +175,7 @@ private: static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs friend void SetupCargoForClimate(LandscapeID l); + friend void FinaliseCargoArray(); }; extern CargoTypes _cargo_mask; diff --git a/src/newgrf.cpp b/src/newgrf.cpp --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -9174,13 +9174,13 @@ static void FinaliseEngineArray() } /** Check for invalid cargoes */ -static void FinaliseCargoArray() -{ - for (CargoSpec *cs : CargoSpec::Iterate()) { - if (!cs->IsValid()) { - cs->name = cs->name_single = cs->units_volume = STR_NEWGRF_INVALID_CARGO; - cs->quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY; - cs->abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV; +void FinaliseCargoArray() +{ + for (CargoSpec &cs : CargoSpec::array) { + if (!cs.IsValid()) { + cs.name = cs.name_single = cs.units_volume = STR_NEWGRF_INVALID_CARGO; + cs.quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY; + cs.abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV; } } }