OpenTTD Source 20261112-master-gbcbec5e63f
cargo_const.h File Reference

Table of all default cargo types. More...

#include "../table/sprites.h"
#include "table/strings.h"

Go to the source code of this file.

Macros

#define MK_STR_CARGO_PLURAL(label_plural)
 Construction macros for the CargoSpec StringID entries.
#define MK_STR_CARGO_SINGULAR(label_singular)
#define MK_STR_QUANTITY(label_plural)
#define MK_STR_ABBREV(label_plural)
#define MK_SPRITE(label_plural)
 Construction macros for the CargoSpec SpriteID entry.
#define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, tae, str_plural, str_singular, str_volume, classes)
 Construction macro for a CargoSpec structure.

Variables

static const CargoSpec _default_cargo []
 Cargo types available by default.
static const std::variant< CargoLabel, int > _default_climate_cargo [NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
 Table of cargo types available in each climate, by default.

Detailed Description

Table of all default cargo types.

Definition in file cargo_const.h.

Macro Definition Documentation

◆ MK

#define MK ( bt,
label,
colour,
weight,
mult,
ip,
td1,
td2,
freight,
tae,
str_plural,
str_singular,
str_volume,
classes )
Value:
{label, bt, PixelColour{colour}, PixelColour{colour}, weight, mult, classes, ip, {td1, td2}, freight, tae, TownProductionEffect::Invalid, TOWN_PRODUCTION_DIVISOR, CargoCallbackMasks{}, \
MK_STR_CARGO_PLURAL(str_plural), MK_STR_CARGO_SINGULAR(str_singular), str_volume, MK_STR_QUANTITY(str_plural), MK_STR_ABBREV(str_plural), \
MK_SPRITE(str_plural), nullptr, nullptr, 0}
static const uint TOWN_PRODUCTION_DIVISOR
By what factor divide town production.
Definition cargotype.h:73
@ Invalid
Invalid town production effect.
Definition cargotype.h:45
EnumBitSet< CargoCallbackMask, uint8_t > CargoCallbackMasks
Bitset of CargoCallbackMask elements.
Colour for pixel/line drawing.
Definition gfx_type.h:307

Construction macro for a CargoSpec structure.

The order of arguments matches the order in which they are defined in CargoSpec. Some macros are used to automatically expand to the correct StringID consts, this means that adding/changing a cargo spec requires updating of the following strings:

  • STR_CARGO_PLURAL_<str_plural>
  • STR_CARGO_SINGULAR_<str_singular>
  • STR_QUANTITY_<str_plural>
  • STR_ABBREV_<str_plural> And the following sprite:
  • SPR_CARGO_<str_plural>
Parameters
btCargo bit number, is INVALID_CARGO_BITNUM for a non-used spec.
labelUnique label of the cargo type.
colourCargoSpec->legend_colour and CargoSpec->rating_colour.
weightWeight of a single unit of this cargo type in 1/16 ton (62.5 kg).
multCapacity multiplier for vehicles. (8 fractional bits).
ipCargoSpec->initial_payment.
td1CargoSpec->transit_periods[0].
td2CargoSpec->transit_periods[1].
freightCargo type is considered to be freight (affects train freight multiplier).
taeThe effect that delivering this cargo type has on towns.
str_pluralThe name suffix used to populate CargoSpec->name, CargoSpec->quantifier, CargoSpec->abbrev and CargoSpec->sprite. See above for more detailed information.
str_singularThe name suffix used to populate CargoSpec->name_single. See above for more information.
str_volumeName of a single unit of cargo of this type.
classesClasses of this cargo type.
See also
CargoClass

Definition at line 51 of file cargo_const.h.

◆ MK_SPRITE

#define MK_SPRITE ( label_plural)
Value:
SPR_CARGO_ ## label_plural

Construction macros for the CargoSpec SpriteID entry.

Definition at line 21 of file cargo_const.h.

◆ MK_STR_ABBREV

#define MK_STR_ABBREV ( label_plural)
Value:
STR_ABBREV_ ## label_plural

Definition at line 19 of file cargo_const.h.

◆ MK_STR_CARGO_PLURAL

#define MK_STR_CARGO_PLURAL ( label_plural)
Value:
STR_CARGO_PLURAL_ ## label_plural

Construction macros for the CargoSpec StringID entries.

Definition at line 16 of file cargo_const.h.

◆ MK_STR_CARGO_SINGULAR

#define MK_STR_CARGO_SINGULAR ( label_singular)
Value:
STR_CARGO_SINGULAR_ ## label_singular

Definition at line 17 of file cargo_const.h.

◆ MK_STR_QUANTITY

#define MK_STR_QUANTITY ( label_plural)
Value:
STR_QUANTITY_ ## label_plural

Definition at line 18 of file cargo_const.h.

Variable Documentation

◆ _default_cargo

const CargoSpec _default_cargo[]
static

Cargo types available by default.

Definition at line 57 of file cargo_const.h.

Referenced by CargoSpec::SetupCargoForClimate.

◆ _default_climate_cargo

const std::variant<CargoLabel, int> _default_climate_cargo[NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
static
Initial value:
= {
}
static constexpr CargoLabel CT_PLASTIC
Cargo label for plastic.
Definition cargo_type.h:67
static constexpr CargoLabel CT_WATER
Cargo label for water.
Definition cargo_type.h:55
static constexpr CargoLabel CT_RUBBER
Cargo label for rubber.
Definition cargo_type.h:51
static constexpr CargoLabel CT_BUBBLES
Cargo label for bubbles.
Definition cargo_type.h:66
static constexpr CargoLabel CT_GRAIN
Cargo label for grain.
Definition cargo_type.h:38
static constexpr CargoLabel CT_IRON_ORE
Cargo label for iron ore.
Definition cargo_type.h:40
static constexpr CargoLabel CT_COAL
Cargo label for coal.
Definition cargo_type.h:33
static constexpr CargoLabel CT_FOOD
Cargo label for food.
Definition cargo_type.h:48
static constexpr CargoLabel CT_MAIL
Cargo label for mail.
Definition cargo_type.h:34
static constexpr CargoLabel CT_TOYS
Cargo label for toys.
Definition cargo_type.h:60
static constexpr CargoLabel CT_WOOD
Cargo label for wood.
Definition cargo_type.h:39
static constexpr CargoLabel CT_WHEAT
Cargo label for wheat.
Definition cargo_type.h:45
static constexpr CargoLabel CT_CANDY
Cargo label for candies/sweets.
Definition cargo_type.h:62
static constexpr CargoLabel CT_GOODS
Cargo label for goods.
Definition cargo_type.h:37
static constexpr CargoLabel CT_PASSENGERS
Cargo label for passengers.
Definition cargo_type.h:32
static constexpr CargoLabel CT_MAIZE
Cargo label for maize.
Definition cargo_type.h:53
static constexpr CargoLabel CT_PAPER
Cargo label for paper.
Definition cargo_type.h:46
static constexpr CargoLabel CT_LIVESTOCK
Cargo label for livestock.
Definition cargo_type.h:36
static constexpr CargoLabel CT_VALUABLES
Cargo label for valuables.
Definition cargo_type.h:42
static constexpr CargoLabel CT_BATTERIES
Cargo label for batteries.
Definition cargo_type.h:61
static constexpr CargoLabel CT_TOFFEE
Cargo label for toffee.
Definition cargo_type.h:63
static constexpr CargoLabel CT_OIL
Cargo label for oil.
Definition cargo_type.h:35
static constexpr CargoLabel CT_GOLD
Cargo label for gold.
Definition cargo_type.h:47
static constexpr CargoLabel CT_FRUIT
Cargo label for fruits.
Definition cargo_type.h:52
static constexpr CargoLabel CT_SUGAR
Cargo label for sugar.
Definition cargo_type.h:59
static constexpr CargoLabel CT_FIZZY_DRINKS
Cargo label for fizzy drinks.
Definition cargo_type.h:68
static constexpr CargoLabel CT_DIAMONDS
Cargo label for diamonds.
Definition cargo_type.h:56
static constexpr CargoLabel CT_STEEL
Cargo label for steel.
Definition cargo_type.h:41
static constexpr CargoLabel CT_COLA
Cargo label for cola.
Definition cargo_type.h:64
static constexpr CargoLabel CT_COPPER_ORE
Cargo label for copper ore.
Definition cargo_type.h:54
static constexpr CargoLabel CT_COTTON_CANDY
Cargo label for cotton candies.
Definition cargo_type.h:65

Table of cargo types available in each climate, by default.

Definition at line 104 of file cargo_const.h.

Referenced by CargoSpec::SetupCargoForClimate.