mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-26 00:45:35 +00:00
Codechange: use EnumBitSet for CargoTypes
This commit is contained in:
committed by
Peter Nelson
parent
962a550d1b
commit
c45aa3c9b6
+4
-4
@@ -62,7 +62,7 @@ void SetupCargoForClimate(LandscapeType l)
|
||||
{
|
||||
assert(to_underlying(l) < std::size(_default_climate_cargo));
|
||||
|
||||
_cargo_mask = 0;
|
||||
_cargo_mask.Reset();
|
||||
_default_cargo_labels.clear();
|
||||
_climate_dependent_cargo_labels.fill(CT_INVALID);
|
||||
_climate_independent_cargo_labels.fill(CT_INVALID);
|
||||
@@ -91,7 +91,7 @@ void SetupCargoForClimate(LandscapeType l)
|
||||
*insert = std::visit(visitor{}, cl);
|
||||
|
||||
if (insert->IsValid()) {
|
||||
SetBit(_cargo_mask, insert->Index());
|
||||
_cargo_mask.Set(insert->Index());
|
||||
_default_cargo_labels.push_back(insert->label);
|
||||
_climate_dependent_cargo_labels[insert->Index()] = insert->label;
|
||||
_climate_independent_cargo_labels[insert->bitnum] = insert->label;
|
||||
@@ -237,14 +237,14 @@ void InitializeSortedCargoSpecs()
|
||||
}
|
||||
|
||||
/* Count the number of standard cargos and fill the mask. */
|
||||
_standard_cargo_mask = 0;
|
||||
_standard_cargo_mask.Reset();
|
||||
uint8_t nb_standard_cargo = 0;
|
||||
for (const auto &cargo : _sorted_cargo_specs) {
|
||||
assert(cargo->town_production_effect != TownProductionEffect::Invalid);
|
||||
CargoSpec::town_production_cargoes[cargo->town_production_effect].push_back(cargo);
|
||||
if (cargo->classes.Test(CargoClass::Special)) break;
|
||||
nb_standard_cargo++;
|
||||
SetBit(_standard_cargo_mask, cargo->Index());
|
||||
_standard_cargo_mask.Set(cargo->Index());
|
||||
}
|
||||
|
||||
/* _sorted_standard_cargo_specs is a subset of _sorted_cargo_specs. */
|
||||
|
||||
Reference in New Issue
Block a user