1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 04:04:09 +01:00

Codechange: Use EnumBitSet for IndustryBehaviours.

This commit is contained in:
Peter Nelson
2025-02-06 20:08:50 +00:00
committed by Peter Nelson
parent 9d451d6350
commit 2bb3f368e3
10 changed files with 111 additions and 112 deletions

View File

@@ -158,7 +158,7 @@ static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixTy
{
static_assert(std::tuple_size_v<std::remove_reference_t<decltype(cargoes)>> <= lengthof(suffixes));
if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) {
if (indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
/* Reworked behaviour with new many-in-many-out scheme */
for (uint j = 0; j < lengthof(suffixes); j++) {
if (IsValidCargoType(cargoes[j])) {
@@ -210,7 +210,7 @@ void GetCargoSuffix(CargoSuffixInOut use_input, CargoSuffixType cst, const Indus
suffix.text.clear();
suffix.display = CSD_CARGO;
if (!IsValidCargoType(cargo)) return;
if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) {
if (indspec->behaviour.Test(IndustryBehaviour::CargoTypesUnlimited)) {
uint8_t local_id = indspec->grf_prop.grffile->cargo_map[cargo]; // should we check the value for valid?
uint cargotype = local_id << 16 | use_input;
GetCargoSuffix(cargotype, cst, ind, ind_type, indspec, suffix);