Go to the documentation of this file.
17 #include "table/strings.h"
88 FOR_ALL_CARGOSPECS(cs) {
107 FOR_ALL_CARGOSPECS(cs) {
122 if (sprite == 0xFFFF) {
139 static char a_name[64];
140 static char b_name[64];
174 FOR_ALL_CARGOSPECS(cargo) {
static const byte INVALID_CARGO
Constant representing invalid cargo.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.
CargoLabel label
Unique label of the cargo type.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
CargoID GetCargoIDByBitnum(uint8 bitnum)
Find the CargoID of a 'bitnum' value.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
#define FOR_ALL_SORTED_CARGOSPECS(var)
Loop header for iterating over cargoes, sorted by name.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
Specification of a cargo type.
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
@ CC_PASSENGERS
Passengers.
uint32 CargoLabel
Globally unique label of a cargo type.
static bool CargoSpecNameSorter(const CargoSpec *const &a, const CargoSpec *const &b)
Sort cargo specifications by their name.
uint8 bitnum
Cargo bit number, is INVALID_CARGO for a non-used spec.
static CargoSpec array[NUM_CARGO]
Array holding all CargoSpecs.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
CargoID Index() const
Determines index of this cargospec.
@ CC_SPECIAL
Special bit used for livery refit tricks instead of normal cargoes.
CargoTypes _cargo_mask
Bitmask of cargo types available.
SpriteID sprite
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain).
uint8 _sorted_standard_cargo_specs_size
Number of standard cargo specifications stored in the _sorted_cargo_specs array.
static bool CargoSpecClassSorter(const CargoSpec *const &a, const CargoSpec *const &b)
Sort cargo specifications by their cargo class.
SpriteID GetCustomCargoSprite(const CargoSpec *cs)
Get the custom sprite for the given cargo type.
static const CargoLabel _default_climate_cargo[NUM_LANDSCAPE][12]
Table of cargo types available in each climate, by default.
void InitializeSortedCargoSpecs()
Initialize the list of sorted cargo specifications.
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.
uint16 multiplier
Capacity multiplier for vehicles. (8 fractional bits)
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
byte CargoID
Cargo slots to indicate a cargo type within a game.
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
byte LandscapeID
Landscape type.
@ CT_INVALID
Invalid cargo type.
#define lastof(x)
Get the last element of an fixed size array.
CargoID GetCargoIDByLabel(CargoLabel cl)
Get the cargo ID by cargo label.
static const CargoSpec _default_cargo[]
Cargo types available by default.