diff --git a/src/cargotype.h b/src/cargotype.h index 10aae014d2..c53404d3be 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -45,7 +45,7 @@ enum TownProductionEffect : uint8_t { }; /** Cargo classes. */ -enum CargoClass { +enum CargoClass : uint16_t { CC_NOAVAILABLE = 0, ///< No cargo class has been specified CC_PASSENGERS = 1 << 0, ///< Passengers CC_MAIL = 1 << 1, ///< Mail @@ -60,6 +60,9 @@ enum CargoClass { CC_SPECIAL = 1 << 15, ///< Special bit used for livery refit tricks instead of normal cargoes. }; +/** Bitmask of cargo classes. */ +using CargoClasses = uint16_t; + static const uint8_t INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo static const uint TOWN_PRODUCTION_DIVISOR = 256; @@ -72,7 +75,7 @@ struct CargoSpec { uint8_t rating_colour; uint8_t weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). uint16_t multiplier = 0x100; ///< Capacity multiplier for vehicles. (8 fractional bits) - uint16_t classes; ///< Classes of this cargo type. @see CargoClass + CargoClasses classes; ///< Classes of this cargo type. @see CargoClass int32_t initial_payment; ///< Initial payment rate before inflation is applied. uint8_t transit_periods[2]; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 3458535b18..5d4934218e 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -318,8 +318,8 @@ struct GRFTempEngineData { NONEMPTY, ///< GRF defined the vehicle as refittable. If the refitmask is empty after translation (cargotypes not available), disable the vehicle. }; - uint16_t cargo_allowed; - uint16_t cargo_disallowed; + CargoClasses cargo_allowed; + CargoClasses cargo_disallowed; RailTypeLabel railtypelabel; uint8_t roadtramtype; const GRFFile *defaultcargo_grf; ///< GRF defining the cargo translation table to use if the default cargo is the 'first refittable'. @@ -9001,8 +9001,8 @@ static void CalculateRefitMasks() static const struct DefaultRefitMasks { uint8_t climate; CargoLabel cargo_label; - CargoTypes cargo_allowed; - CargoTypes cargo_disallowed; + CargoClasses cargo_allowed; + CargoClasses cargo_disallowed; } _default_refit_masks[] = { {T | A | S | Y, CT_PASSENGERS, CC_PASSENGERS, 0}, {T | A | S , CT_MAIL, CC_MAIL, 0},