68 static const uint TOWN_PRODUCTION_DIVISOR = 256;
74 uint8_t legend_colour;
75 uint8_t rating_colour;
80 uint8_t transit_periods[2];
99 Money current_payment;
142 inline uint64_t WeightOfNUnits(uint32_t n)
const
144 return n * this->weight / 16u;
147 uint64_t WeightOfNUnitsInTrain(uint32_t n)
const;
156 typedef size_t difference_type;
157 typedef std::forward_iterator_tag iterator_category;
159 explicit Iterator(
size_t index) : index(index)
161 this->ValidateIndex();
164 bool operator==(
const Iterator &other)
const {
return this->index == other.index; }
165 bool operator!=(
const Iterator &other)
const {
return !(*
this == other); }
167 Iterator & operator++() { this->index++; this->ValidateIndex();
return *
this; }
182 bool empty() {
return this->begin() == this->end(); }
197 static inline std::map<CargoLabel, CargoID>
label_map{};
216 return INVALID_CARGO;
Functions related to bit mathematics.
Types related to cargoes...
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
bool IsDefaultCargo(CargoID cid)
Test if a cargo is a default cargo type.
std::array< uint8_t, NUM_CARGO > _sorted_cargo_types
Sort order of cargoes by cargo ID.
Dimension GetLargestCargoIconSize()
Get dimensions of largest cargo icon.
bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
std::span< const CargoSpec * > _sorted_standard_cargo_specs
Standard cargo specifications sorted alphabetically by name.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.
static const uint8_t INVALID_CARGO_BITNUM
Constant representing invalid cargo.
void BuildCargoLabelMap()
Build cargo label map.
@ CC_REFRIGERATED
Refrigerated cargo (Food, Fruit)
@ CC_ARMOURED
Armoured cargo (Valuables, Gold, Diamonds)
@ CC_BULK
Bulk cargo (Coal, Grain etc., Ores, Fruit)
@ CC_NOAVAILABLE
No cargo class has been specified.
@ CC_EXPRESS
Express cargo (Goods, Food, Candy, but also possible for passengers)
@ CC_COVERED
Covered/Sheltered Freight (Transportation in Box Vans, Silo Wagons, etc.)
@ CC_LIQUID
Liquids (Oil, Water, Rubber)
@ CC_PIECE_GOODS
Piece goods (Livestock, Wood, Steel, Paper)
@ CC_PASSENGERS
Passengers.
@ CC_HAZARDOUS
Hazardous cargo (Nuclear Fuel, Explosives, etc.)
@ CC_SPECIAL
Special bit used for livery refit tricks instead of normal cargoes.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
TownProductionEffect
Town effect when producing cargo.
@ INVALID_TPE
Invalid town production effect.
@ TPE_NONE
Town will not produce this cargo type.
@ TPE_PASSENGERS
Cargo behaves passenger-like for production.
@ TPE_MAIL
Cargo behaves mail-like for production.
void InitializeSortedCargoSpecs()
Initialize the list of sorted cargo specifications.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
uint16_t CargoClasses
Bitmask of cargo classes.
TownAcceptanceEffect
Town growth effect when delivering cargo.
@ NUM_TAE
Amount of town effects.
@ TAE_END
End of town effects.
@ TAE_GOODS
Cargo behaves goods/candy-like.
@ TAE_NONE
Cargo has no effect.
@ TAE_PASSENGERS
Cargo behaves passenger-like.
@ TAE_MAIL
Cargo behaves mail-like.
@ TAE_FOOD
Cargo behaves food/fizzy-drinks-like.
@ TAE_WATER
Cargo behaves water-like.
CargoTypes _cargo_mask
Bitmask of cargo types available.
Types related to the economy.
Types related to the graphics and/or input devices.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Types related to the landscape.
uint8_t LandscapeID
Landscape type.
#define lengthof(array)
Return the length of an fixed size array.
Types related to strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Comparator to sort CargoID by according to desired order.
Iterator to iterate all valid CargoSpec.
Specification of a cargo type.
int32_t initial_payment
Initial payment rate before inflation is applied.
CargoClasses classes
Classes of this cargo type.
uint16_t multiplier
Capacity multiplier for vehicles. (8 fractional bits)
StringID units_volume
Name of a single unit of cargo of this type.
CargoID Index() const
Determines index of this cargospec.
StringID abbrev
Two letter abbreviation for this cargo type.
uint8_t bitnum
Cargo bit number, is INVALID_CARGO_BITNUM for a non-used spec.
StringID quantifier
Text for multiple units of cargo of this type.
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
SpriteID sprite
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain).
bool is_freight
Cargo type is considered to be freight (affects train freight multiplier).
uint8_t weight
Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
CargoLabel label
Unique label of the cargo type.
const struct GRFFile * grffile
NewGRF where #group belongs to.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
static CargoSpec array[NUM_CARGO]
Array holding all CargoSpecs.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
friend void BuildCargoLabelMap()
Build cargo label map.
uint8_t callback_mask
Bitmask of cargo callbacks that have to be called.
StringID name
Name of this type of cargo.
friend void FinaliseCargoArray()
Check for invalid cargoes.
TownProductionEffect town_production_effect
The effect on town cargo production.
TownAcceptanceEffect town_acceptance_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
static std::map< CargoLabel, CargoID > label_map
Translation map from CargoLabel to Cargo ID.
friend void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
uint16_t town_production_multiplier
Town production multipler, if commanded by TownProductionEffect.
static std::array< std::vector< const CargoSpec * >, NUM_TPE > town_production_cargoes
List of cargo specs for each Town Product Effect.
bool IsValid() const
Tests for validity of this cargospec.
StringID name_single
Name of a single entity of this type of cargo.
static size_t GetArraySize()
Total number of cargospecs, both valid and invalid.
Dimensions (a width and height) of a rectangle in 2D.
Dynamic data of a loaded NewGRF.
Tindex index
Index of this pool item.
Iterable ensemble of each set bit in a value.