18 #include "table/strings.h" 45 memset(CargoSpec::array, 0,
sizeof(CargoSpec::array));
89 FOR_ALL_CARGOSPECS(cs) {
108 FOR_ALL_CARGOSPECS(cs) {
123 if (sprite == 0xFFFF) {
128 if (sprite == 0) sprite = SPR_CARGO_GOODS;
140 static char a_name[64];
141 static char b_name[64];
175 FOR_ALL_CARGOSPECS(cargo) {
Functions related to OTTD's strings.
Special bit used for livery refit tricks instead of normal cargoes.
SpriteID GetCustomCargoSprite(const CargoSpec *cs)
Get the custom sprite for the given cargo type.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
CargoTypes _cargo_mask
Bitmask of cargo types available.
CargoID GetCargoIDByLabel(CargoLabel cl)
Get the cargo ID by cargo label.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Maximal number of cargo types in a game.
#define FOR_ALL_SORTED_CARGOSPECS(var)
Loop header for iterating over cargoes, sorted by name.
Specification of a cargo type.
#define lastof(x)
Get the last element of an fixed size array.
uint16 classes
Classes of this cargo type.
StringID name
Name of this type of cargo.
uint16 multiplier
Capacity multiplier for vehicles. (8 fractional bits)
Functions related to low-level strings.
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
static bool CargoSpecNameSorter(const CargoSpec *const &a, const CargoSpec *const &b)
Sort cargo specifications by their name.
Table of all default cargo types.
static const CargoLabel _default_climate_cargo[NUM_LANDSCAPE][12]
Table of cargo types available in each climate, by default.
CargoLabel label
Unique label of the cargo type.
static const CargoSpec _default_cargo[]
Cargo types available by default.
#define lengthof(x)
Return the length of an fixed size array.
static bool CargoSpecClassSorter(const CargoSpec *const &a, const CargoSpec *const &b)
Sort cargo specifications by their cargo class.
uint8 _sorted_standard_cargo_specs_size
Number of standard cargo specifications stored in the _sorted_cargo_specs array.
CargoID GetCargoIDByBitnum(uint8 bitnum)
Find the CargoID of a 'bitnum' value.
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
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.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Cargo support for NewGRFs.
void InitializeSortedCargoSpecs()
Initialize the list of sorted cargo specifications.
static const byte INVALID_CARGO
Constant representing invalid cargo.
uint32 CargoLabel
Globally unique label of a cargo type.
Types/functions related to cargoes.
CargoID Index() const
Determines index of this cargospec.
static CargoSpec array[NUM_CARGO]
Array holding all CargoSpecs.
uint8 bitnum
Cargo bit number, is INVALID_CARGO for a non-used spec.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.
byte CargoID
Cargo slots to indicate a cargo type within a game.
SpriteID sprite
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain)...
This file contains all sprite-related enums and defines.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.