Use CargoID instead of CargoSpec in town_production_cargoes
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
CargoSpec CargoSpec::array[NUM_CARGO];
|
CargoSpec CargoSpec::array[NUM_CARGO];
|
||||||
std::array<std::vector<const CargoSpec *>, NUM_TPE> CargoSpec::town_production_cargoes{};
|
std::array<std::vector<CargoID>, NUM_TPE> CargoSpec::town_production_cargoes{};
|
||||||
std::array<CargoTypes, NUM_TPE> CargoSpec::town_production_cargo_mask{};
|
std::array<CargoTypes, NUM_TPE> CargoSpec::town_production_cargo_mask{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,7 +237,7 @@ void InitializeSortedCargoSpecs()
|
|||||||
uint8_t nb_standard_cargo = 0;
|
uint8_t nb_standard_cargo = 0;
|
||||||
for (const auto &cargo : _sorted_cargo_specs) {
|
for (const auto &cargo : _sorted_cargo_specs) {
|
||||||
assert(cargo->town_production_effect != INVALID_TPE);
|
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());
|
SetBit(CargoSpec::town_production_cargo_mask[cargo->town_production_effect], cargo->Index());
|
||||||
if (cargo->classes & CC_SPECIAL) break;
|
if (cargo->classes & CC_SPECIAL) break;
|
||||||
nb_standard_cargo++;
|
nb_standard_cargo++;
|
||||||
|
@@ -197,7 +197,7 @@ struct CargoSpec {
|
|||||||
static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); }
|
static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); }
|
||||||
|
|
||||||
/** List of cargo specs for each Town Product Effect. */
|
/** List of cargo specs for each Town Product Effect. */
|
||||||
static std::array<std::vector<const CargoSpec *>, NUM_TPE> town_production_cargoes;
|
static std::array<std::vector<CargoID>, NUM_TPE> town_production_cargoes;
|
||||||
|
|
||||||
/** Mask of cargo IDs for each Town Product Effect. */
|
/** Mask of cargo IDs for each Town Product Effect. */
|
||||||
static std::array<CargoTypes, NUM_TPE> town_production_cargo_mask;
|
static std::array<CargoTypes, NUM_TPE> town_production_cargo_mask;
|
||||||
|
@@ -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;
|
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 (auto tpe : {TPE_PASSENGERS, TPE_MAIL}) {
|
||||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[tpe]) {
|
for (CargoID cid : CargoSpec::town_production_cargoes[tpe]) {
|
||||||
CargoID cid = cs->Index();
|
|
||||||
SetDParam(0, 1ULL << cid);
|
SetDParam(0, 1ULL << cid);
|
||||||
SetDParam(1, this->town->supplied[cid].old_act);
|
SetDParam(1, this->town->supplied[cid].old_act);
|
||||||
SetDParam(2, this->town->supplied[cid].old_max);
|
SetDParam(2, this->town->supplied[cid].old_max);
|
||||||
|
Reference in New Issue
Block a user