diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 0a07138e7d..f6509dd389 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -24,7 +24,7 @@ #include "safeguards.h" CargoSpec CargoSpec::array[NUM_CARGO]; -std::array, NUM_TPE> CargoSpec::town_production_cargoes{}; +std::array, NUM_TPE> CargoSpec::town_production_cargoes{}; std::array CargoSpec::town_production_cargo_mask{}; /** @@ -237,7 +237,7 @@ void InitializeSortedCargoSpecs() uint8_t nb_standard_cargo = 0; for (const auto &cargo : _sorted_cargo_specs) { assert(cargo->town_production_effect != INVALID_TPE); - CargoSpec::town_production_cargoes[cargo->town_production_effect].push_back(cargo); + CargoSpec::town_production_cargoes[cargo->town_production_effect].push_back(cargo->Index()); SetBit(CargoSpec::town_production_cargo_mask[cargo->town_production_effect], cargo->Index()); if (cargo->classes & CC_SPECIAL) break; nb_standard_cargo++; diff --git a/src/cargotype.h b/src/cargotype.h index c5f7bce8b0..f79328086f 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -197,7 +197,7 @@ struct CargoSpec { static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); } /** List of cargo specs for each Town Product Effect. */ - static std::array, NUM_TPE> town_production_cargoes; + static std::array, NUM_TPE> town_production_cargoes; /** Mask of cargo IDs for each Town Product Effect. */ static std::array town_production_cargo_mask; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index d97b23ee9e..20f6b7947f 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -595,8 +595,7 @@ public: StringID str_last_period = EconTime::UsingWallclockUnits() ? STR_TOWN_VIEW_CARGO_LAST_MINUTE_MAX : STR_TOWN_VIEW_CARGO_LAST_MONTH_MAX; for (auto tpe : {TPE_PASSENGERS, TPE_MAIL}) { - for (const CargoSpec *cs : CargoSpec::town_production_cargoes[tpe]) { - CargoID cid = cs->Index(); + for (CargoID cid : CargoSpec::town_production_cargoes[tpe]) { SetDParam(0, 1ULL << cid); SetDParam(1, this->town->supplied[cid].old_act); SetDParam(2, this->town->supplied[cid].old_max);