OpenTTD Source  14.0-beta1
cargo_type.h File Reference
#include "core/enum_type.hpp"

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

typedef byte CargoID
 Cargo slots to indicate a cargo type within a game. More...
 
typedef uint64_t CargoTypes
 
typedef uint16_t SourceID
 Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
 

Enumerations

enum  CargoType {
  CT_PASSENGERS = 0, CT_COAL = 1, CT_MAIL = 2, CT_OIL = 3,
  CT_LIVESTOCK = 4, CT_GOODS = 5, CT_GRAIN = 6, CT_WOOD = 7,
  CT_IRON_ORE = 8, CT_STEEL = 9, CT_VALUABLES = 10, CT_WHEAT = 6,
  CT_HILLY_UNUSED = 8, CT_PAPER = 9, CT_GOLD = 10, CT_FOOD = 11,
  CT_RUBBER = 1, CT_FRUIT = 4, CT_MAIZE = 6, CT_COPPER_ORE = 8,
  CT_WATER = 9, CT_DIAMONDS = 10, CT_SUGAR = 1, CT_TOYS = 3,
  CT_BATTERIES = 4, CT_CANDY = 5, CT_TOFFEE = 6, CT_COLA = 7,
  CT_COTTON_CANDY = 8, CT_BUBBLES = 9, CT_PLASTIC = 10, CT_FIZZY_DRINKS = 11,
  CT_INVALID = 0xFF
}
 Available types of cargo. More...
 
enum  SourceType : byte { SourceType::Industry, SourceType::Town, SourceType::Headquarters }
 Types of cargo source and destination. More...
 

Functions

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

Variables

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 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.

Typedef Documentation

◆ CargoID

typedef byte CargoID

Cargo slots to indicate a cargo type within a game.

Numbers are re-used between different climates.

See also
CargoTypes

Definition at line 20 of file cargo_type.h.

Enumeration Type Documentation

◆ CargoType

enum CargoType

Available types of cargo.

Enumerator
CT_INVALID 

Invalid cargo type.

Definition at line 23 of file cargo_type.h.

◆ SourceType

enum SourceType : byte
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 120 of file cargo_type.h.