OpenTTD Source: src/table/cargo_const.h File Reference

OpenTTD Source 13.2.1

Macros | Variables
cargo_const.h File Reference

Go to the source code of this file.

## Macros
#define | MK_STR_CARGO_PLURAL(label_plural) STR_CARGO_PLURAL_ ## label_plural
| Construction macros for the CargoSpec StringID entries.
#define | MK_STR_CARGO_SINGULAR(label_singular) STR_CARGO_SINGULAR_ ## label_singular
#define | MK_STR_QUANTITY(label_plural) STR_QUANTITY_ ## label_plural
#define | MK_STR_ABBREV(label_plural) STR_ABBREV_ ## label_plural
#define | MK_SPRITE(label_plural) SPR_CARGO_ ## label_plural
| Construction macros for the CargoSpec SpriteID entry.
#define | MK(bt, label, colour, weight, mult, ip, td1, td2, freight, te, str_plural, str_singular, str_volume, classes)
| Construction macro for a CargoSpec structure. More...

## Variables
static const CargoSpec | _default_cargo []
| Cargo types available by default.
static const CargoLabel | _default_climate_cargo [NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
| Table of cargo types available in each climate, by default. More...

## 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,
|  |  | te,
|  |  | str_plural,
|  |  | str_singular,
|  |  | str_volume,
|  |  | classes
| ) |  |

Value:
{bt, label, colour, colour, weight, mult, ip, {td1, td2}, freight, te, 0, \
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), classes, nullptr, nullptr, 0}

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

  bt | Cargo bit number, is INVALID_CARGO for a non-used spec.
  label | Unique label of the cargo type.
  colour | CargoSpec->legend_colour and CargoSpec->rating_colour.
  weight | Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
  mult | Capacity multiplier for vehicles. (8 fractional bits).
  ip | CargoSpec->initial_payment.
  td1 | CargoSpec->transit_days[0].
  td2 | CargoSpec->transit_days[1].
  freight | Cargo type is considered to be freight (affects train freight multiplier).
  te | The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
  str_plural | The name suffix used to populate CargoSpec->name, CargoSpec->quantifier, CargoSpec->abbrev and CargoSpec->sprite. See above for more detailed information.
  str_singular | The name suffix used to populate CargoSpec->name_single. See above for more information.
  str_volume | Name of a single unit of cargo of this type.
  classes | Classes of this cargo type.

See also
  CargoClass

Definition at line 46 of file cargo_const.h.

## Variable Documentation

## ◆ _default_climate_cargo

const CargoLabel _default_climate_cargo[NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
| static

Initial value:
= {
{ 'PASS', 'COAL', 'MAIL', 'OIL_', 'LVST', 'GOOD', 'GRAI', 'WOOD', 'IORE', 'STEL', 'VALU', 33, },
{ 'PASS', 'COAL', 'MAIL', 'OIL_', 'LVST', 'GOOD', 'WHEA', 'WOOD', 34, 'PAPR', 'GOLD', 'FOOD', },
{ 'PASS', 'RUBR', 'MAIL', 4, 'FRUT', 'GOOD', 'MAIZ', 11, 'CORE', 'WATR', 'DIAM', 'FOOD', },
{ 'PASS', 'SUGR', 'MAIL', 'TOYS', 'BATT', 'SWET', 'TOFF', 'COLA', 'CTCD', 'BUBL', 'PLST', 'FZDR', },
}

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

Definition at line 99 of file cargo_const.h.

Referenced by GetDefaultCargoID(), and SetupCargoForClimate().