Go to the documentation of this file.
65 uint8 transit_days[2];
83 Money current_payment;
126 inline uint64 WeightOfNUnits(uint32 n)
const
128 return n * this->weight / 16u;
131 uint64 WeightOfNUnitsInTrain(uint32 n)
const;
140 typedef size_t difference_type;
141 typedef std::forward_iterator_tag iterator_category;
143 explicit Iterator(
size_t index) : index(index)
145 this->ValidateIndex();
148 bool operator==(
const Iterator &other)
const {
return this->index == other.index; }
149 bool operator!=(
const Iterator &other)
const {
return !(*
this == other); }
151 Iterator & operator++() { this->index++; this->ValidateIndex();
return *
this; }
166 bool empty() {
return this->begin() == this->end(); }
static const byte INVALID_CARGO
Constant representing invalid cargo.
CargoType
Available types of cargo.
CargoID GetDefaultCargoID(LandscapeID l, CargoType ct)
Get the cargo ID of a default cargo, if present.
@ CC_HAZARDOUS
Hazardous cargo (Nuclear Fuel, Explosives, etc.)
uint8 callback_mask
Bitmask of cargo callbacks that have to be called.
@ CC_COVERED
Covered/Sheltered Freight (Transportation in Box Vans, Silo Wagons, etc.)
CargoLabel label
Unique label of the cargo type.
CargoID GetCargoIDByBitnum(uint8 bitnum)
Find the CargoID of a 'bitnum' value.
@ TE_GOODS
Cargo behaves goods/candy-like.
Iterator to iterate all valid CargoSpec.
int32 initial_payment
Initial payment rate before inflation is applied.
TownEffect town_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
CargoTypes _cargo_mask
Bitmask of cargo types available.
@ CC_NOAVAILABLE
No cargo class has been specified.
@ CC_EXPRESS
Express cargo (Goods, Food, Candy, but also possible for passengers)
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
void InitializeSortedCargoSpecs()
Initialize the list of sorted cargo specifications.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
Specification of a cargo type.
@ CC_LIQUID
Liquids (Oil, Water, Rubber)
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
@ CC_PASSENGERS
Passengers.
static size_t GetArraySize()
Total number of cargospecs, both valid and invalid.
uint32 CargoLabel
Globally unique label of a cargo type.
uint8 bitnum
Cargo bit number, is INVALID_CARGO for a non-used spec.
TownEffect
Town growth effect when delivering cargo.
static CargoSpec array[NUM_CARGO]
Array holding all CargoSpecs.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
CargoID GetCargoIDByLabel(CargoLabel cl)
Get the cargo ID by cargo label.
CargoID Index() const
Determines index of this cargospec.
span< const CargoSpec * > _sorted_standard_cargo_specs
Standard cargo specifications sorted alphabetically by name.
@ TE_NONE
Cargo has no effect.
Iterable ensemble of each set bit in a value.
@ CC_SPECIAL
Special bit used for livery refit tricks instead of normal cargoes.
A trimmed down version of what std::span will be in C++20.
StringID units_volume
Name of a single unit of cargo of this type.
bool IsValid() const
Tests for validity of this cargospec.
friend void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
@ CC_PIECE_GOODS
Piece goods (Livestock, Wood, Steel, Paper)
@ CC_BULK
Bulk cargo (Coal, Grain etc., Ores, Fruit)
const struct GRFFile * grffile
NewGRF where #group belongs to.
SpriteID sprite
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain).
uint8 weight
Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
bool is_freight
Cargo type is considered to be freight (affects train freight multiplier).
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ CC_ARMOURED
Armoured cargo (Valuables, Gold, Diamonds)
@ CC_REFRIGERATED
Refrigerated cargo (Food, Fruit)
StringID quantifier
Text for multiple units of cargo of this type.
uint16 classes
Classes of this cargo type.
@ NUM_CARGO
Maximal number of cargo types in a game.
StringID name
Name of this type of cargo.
@ TE_MAIL
Cargo behaves mail-like.
StringID name_single
Name of a single entity of this type of cargo.
StringID abbrev
Two letter abbreviation for this cargo type.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
uint16 multiplier
Capacity multiplier for vehicles. (8 fractional bits)
@ TE_WATER
Cargo behaves water-like.
#define lengthof(x)
Return the length of an fixed size array.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
@ NUM_TE
Amount of town effects.
byte CargoID
Cargo slots to indicate a cargo type within a game.
byte LandscapeID
Landscape type.
@ TE_FOOD
Cargo behaves food/fizzy-drinks-like.
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
@ TE_END
End of town effects.
Dynamic data of a loaded NewGRF.
@ TE_PASSENGERS
Cargo behaves passenger-like.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.