OpenTTD Source  20240917-master-g9ab0a47812
cargo_type.h File Reference

Go to the source code of this file.

Data Structures

struct  CargoArray
 Class for storing amounts of cargo. More...
 

Namespaces

 CargoFilterCriteria
 Special cargo filter criteria.
 

Typedefs

using CargoLabel = StrongType::Typedef< uint32_t, struct CargoLabelTag, StrongType::Compare >
 Globally unique label of a cargo type.
 
using CargoID = uint8_t
 Cargo slots to indicate a cargo type within a game.
 
typedef uint64_t CargoTypes
 
typedef uint16_t SourceID
 Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
 

Enumerations

enum  MixedCargoType { MCT_LIVESTOCK_FRUIT, MCT_GRAIN_WHEAT_MAIZE, MCT_VALUABLES_GOLD_DIAMONDS }
 Mixed cargo types for definitions with cargo that can vary depending on climate. More...
 
enum  SourceType : uint8_t { SourceType::Industry, SourceType::Town, SourceType::Headquarters }
 Types of cargo source and destination. More...
 

Functions

bool IsValidCargoType (CargoLabel t)
 Test whether cargo type is not CT_INVALID.
 
bool IsValidCargoID (CargoID t)
 Test whether cargo type is not INVALID_CARGO.
 

Variables

static constexpr CargoLabel CT_PASSENGERS = CargoLabel{'PASS'}
 Available types of cargo Labels may be re-used between different climates.
 
static constexpr CargoLabel CT_COAL = CargoLabel{'COAL'}
 
static constexpr CargoLabel CT_MAIL = CargoLabel{'MAIL'}
 
static constexpr CargoLabel CT_OIL = CargoLabel{'OIL_'}
 
static constexpr CargoLabel CT_LIVESTOCK = CargoLabel{'LVST'}
 
static constexpr CargoLabel CT_GOODS = CargoLabel{'GOOD'}
 
static constexpr CargoLabel CT_GRAIN = CargoLabel{'GRAI'}
 
static constexpr CargoLabel CT_WOOD = CargoLabel{'WOOD'}
 
static constexpr CargoLabel CT_IRON_ORE = CargoLabel{'IORE'}
 
static constexpr CargoLabel CT_STEEL = CargoLabel{'STEL'}
 
static constexpr CargoLabel CT_VALUABLES = CargoLabel{'VALU'}
 
static constexpr CargoLabel CT_WHEAT = CargoLabel{'WHEA'}
 
static constexpr CargoLabel CT_PAPER = CargoLabel{'PAPR'}
 
static constexpr CargoLabel CT_GOLD = CargoLabel{'GOLD'}
 
static constexpr CargoLabel CT_FOOD = CargoLabel{'FOOD'}
 
static constexpr CargoLabel CT_RUBBER = CargoLabel{'RUBR'}
 
static constexpr CargoLabel CT_FRUIT = CargoLabel{'FRUT'}
 
static constexpr CargoLabel CT_MAIZE = CargoLabel{'MAIZ'}
 
static constexpr CargoLabel CT_COPPER_ORE = CargoLabel{'CORE'}
 
static constexpr CargoLabel CT_WATER = CargoLabel{'WATR'}
 
static constexpr CargoLabel CT_DIAMONDS = CargoLabel{'DIAM'}
 
static constexpr CargoLabel CT_SUGAR = CargoLabel{'SUGR'}
 
static constexpr CargoLabel CT_TOYS = CargoLabel{'TOYS'}
 
static constexpr CargoLabel CT_BATTERIES = CargoLabel{'BATT'}
 
static constexpr CargoLabel CT_CANDY = CargoLabel{'SWET'}
 
static constexpr CargoLabel CT_TOFFEE = CargoLabel{'TOFF'}
 
static constexpr CargoLabel CT_COLA = CargoLabel{'COLA'}
 
static constexpr CargoLabel CT_COTTON_CANDY = CargoLabel{'CTCD'}
 
static constexpr CargoLabel CT_BUBBLES = CargoLabel{'BUBL'}
 
static constexpr CargoLabel CT_PLASTIC = CargoLabel{'PLST'}
 
static constexpr CargoLabel CT_FIZZY_DRINKS = CargoLabel{'FZDR'}
 
static constexpr CargoLabel CT_NONE = CT_PASSENGERS
 Dummy label for engines that carry no cargo; they actually carry 0 passengers.
 
static constexpr CargoLabel CT_INVALID = CargoLabel{UINT32_MAX}
 Invalid cargo type.
 
static const CargoID NUM_ORIGINAL_CARGO = 12
 Original number of cargo types.
 
static const CargoID NUM_CARGO = 64
 Maximum number of cargo types in a game.
 
static const CargoID CARGO_AUTO_REFIT = 0xFD
 Automatically choose cargo type when doing auto refitting.
 
static const CargoID CARGO_NO_REFIT = 0xFE
 Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-renew).
 
static const CargoID INVALID_CARGO = UINT8_MAX
 
static constexpr CargoID CargoFilterCriteria::CF_ANY = NUM_CARGO
 Show all items independent of carried cargo (i.e. no filtering)
 
static constexpr CargoID CargoFilterCriteria::CF_NONE = NUM_CARGO + 1
 Show only items which do not carry cargo (e.g. train engines)
 
static constexpr CargoID CargoFilterCriteria::CF_ENGINES = NUM_CARGO + 2
 Show only engines (for rail vehicles only)
 
static constexpr CargoID CargoFilterCriteria::CF_FREIGHT = NUM_CARGO + 3
 Show only vehicles which carry any freight (non-passenger) cargo.
 
static constexpr CargoID CargoFilterCriteria::CF_NO_RATING = NUM_CARGO + 4
 Show items with no rating (station list)
 
static constexpr CargoID CargoFilterCriteria::CF_SELECT_ALL = NUM_CARGO + 5
 Select all items (station list)
 
static constexpr CargoID CargoFilterCriteria::CF_EXPAND_LIST = NUM_CARGO + 6
 Expand list to show all items (station list)
 
static const CargoTypes ALL_CARGOTYPES = (CargoTypes)UINT64_MAX
 
static const SourceID INVALID_SOURCE = 0xFFFF
 Invalid/unknown index of source.
 

Detailed Description

Types related to cargoes...

Definition in file cargo_type.h.

Enumeration Type Documentation

◆ MixedCargoType

Mixed cargo types for definitions with cargo that can vary depending on climate.

Enumerator
MCT_LIVESTOCK_FRUIT 

Cargo can be livestock or fruit.

MCT_GRAIN_WHEAT_MAIZE 

Cargo can be grain, wheat or maize.

MCT_VALUABLES_GOLD_DIAMONDS 

Cargo can be valuables, gold or diamonds.

Definition at line 83 of file cargo_type.h.

◆ SourceType

enum SourceType : uint8_t
strong

Types of cargo source and destination.

Enumerator
Industry 

Source/destination is an industry.

Town 

Source/destination is a town.

Headquarters 

Source/destination are company headquarters.

Definition at line 137 of file cargo_type.h.