OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
17 #include "table/strings.h"
110 if (cs->label == cl)
return cs->Index();
128 if (cs->bitnum == bitnum)
return cs->Index();
142 if (sprite == 0xFFFF) {
158 static char a_name[64];
159 static char b_name[64];
201 uint8 nb_standard_cargo = 0;
static const byte INVALID_CARGO
Constant representing invalid cargo.
CargoType
Available types of 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.
static const CargoLabel _default_climate_cargo[NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
Table of cargo types available in each climate, by default.
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.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
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.
@ 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.
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).
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.
span< const CargoSpec * > _sorted_standard_cargo_specs
Standard cargo specifications sorted alphabetically by name.
CargoID GetDefaultCargoID(LandscapeID l, CargoType ct)
Get the cargo ID of a default cargo, if present.
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.