|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
65 static const uint TOWN_PRODUCTION_DIVISOR = 256;
71 uint8_t legend_colour;
72 uint8_t rating_colour;
77 uint8_t transit_periods[2];
96 Money current_payment;
139 inline uint64_t WeightOfNUnits(uint32_t n)
const
141 return n * this->weight / 16u;
144 uint64_t WeightOfNUnitsInTrain(uint32_t n)
const;
153 typedef size_t difference_type;
154 typedef std::forward_iterator_tag iterator_category;
156 explicit Iterator(
size_t index) : index(index)
158 this->ValidateIndex();
161 bool operator==(
const Iterator &other)
const {
return this->index == other.index; }
162 bool operator!=(
const Iterator &other)
const {
return !(*
this == other); }
164 Iterator & operator++() { this->index++; this->ValidateIndex();
return *
this; }
179 bool empty() {
return this->begin() == this->end(); }
194 static inline std::map<CargoLabel, CargoID>
label_map{};
214 return INVALID_CARGO;
@ CC_HAZARDOUS
Hazardous cargo (Nuclear Fuel, Explosives, etc.)
@ CC_COVERED
Covered/Sheltered Freight (Transportation in Box Vans, Silo Wagons, etc.)
@ TPE_NONE
Town will not produce this cargo type.
@ TPE_MAIL
Cargo behaves mail-like for production.
CargoLabel label
Unique label of the cargo type.
@ TAE_FOOD
Cargo behaves food/fizzy-drinks-like.
Dimensions (a width and height) of a rectangle in 2D.
Iterator to iterate all valid CargoSpec.
CargoTypes _cargo_mask
Bitmask of cargo types available.
@ CC_NOAVAILABLE
No cargo class has been specified.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
@ CC_EXPRESS
Express cargo (Goods, Food, Candy, but also possible for passengers)
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
void InitializeSortedCargoSpecs()
Initialize the list of sorted cargo specifications.
static std::map< CargoLabel, CargoID > label_map
Translation map from CargoLabel to Cargo ID.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
Specification of a cargo type.
@ CC_LIQUID
Liquids (Oil, Water, Rubber)
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
@ CC_PASSENGERS
Passengers.
static size_t GetArraySize()
Total number of cargospecs, both valid and invalid.
int32_t initial_payment
Initial payment rate before inflation is applied.
static CargoSpec array[NUM_CARGO]
Array holding all CargoSpecs.
CargoID Index() const
Determines index of this cargospec.
Iterable ensemble of each set bit in a value.
@ CC_SPECIAL
Special bit used for livery refit tricks instead of normal cargoes.
uint8_t weight
Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
TownAcceptanceEffect
Town growth effect when delivering cargo.
static const byte INVALID_CARGO_BITNUM
Constant representing invalid cargo.
StringID units_volume
Name of a single unit of cargo of this type.
bool IsValid() const
Tests for validity of this cargospec.
friend void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
@ TAE_GOODS
Cargo behaves goods/candy-like.
@ CC_PIECE_GOODS
Piece goods (Livestock, Wood, Steel, Paper)
@ NUM_TAE
Amount of town effects.
static std::array< std::vector< const CargoSpec * >, NUM_TPE > town_production_cargoes
List of cargo specs for each Town Product Effect.
@ CC_BULK
Bulk cargo (Coal, Grain etc., Ores, Fruit)
const struct GRFFile * grffile
NewGRF where #group belongs to.
Dimension GetLargestCargoIconSize()
Get dimensions of largest cargo icon.
friend void FinaliseCargoArray()
Check for invalid cargoes.
SpriteID sprite
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain).
uint8_t callback_mask
Bitmask of cargo callbacks that have to be called.
friend void BuildCargoLabelMap()
Build cargo label map.
byte CargoID
Cargo slots to indicate a cargo type within a game.
bool is_freight
Cargo type is considered to be freight (affects train freight multiplier).
uint8_t bitnum
Cargo bit number, is INVALID_CARGO_BITNUM for a non-used spec.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
void BuildCargoLabelMap()
Build cargo label map.
@ INVALID_TPE
Invalid town production effect.
TownProductionEffect town_production_effect
The effect on town cargo production.
@ CC_ARMOURED
Armoured cargo (Valuables, Gold, Diamonds)
@ CC_REFRIGERATED
Refrigerated cargo (Food, Fruit)
StringID quantifier
Text for multiple units of cargo of this type.
@ TAE_WATER
Cargo behaves water-like.
std::span< const CargoSpec * > _sorted_standard_cargo_specs
Standard cargo specifications sorted alphabetically by name.
StringID name
Name of this type of cargo.
StringID name_single
Name of a single entity of this type of cargo.
StringID abbrev
Two letter abbreviation for this cargo type.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
CargoID GetCargoIDByBitnum(uint8_t bitnum)
Find the CargoID of a 'bitnum' value.
TownProductionEffect
Town effect when producing cargo.
#define lengthof(x)
Return the length of an fixed size array.
bool IsDefaultCargo(CargoID cid)
Test if a cargo is a default cargo type.
void SetupCargoForClimate(LandscapeID l)
Set up the default cargo types for the given landscape type.
Comparator to sort CargoID by according to desired order.
@ TAE_END
End of town effects.
@ TAE_NONE
Cargo has no effect.
byte LandscapeID
Landscape type.
std::array< uint8_t, NUM_CARGO > _sorted_cargo_types
Sort order of cargoes by cargo ID.
@ TPE_PASSENGERS
Cargo behaves passenger-like for production.
uint16_t town_production_multiplier
Town production multipler, if commanded by TownProductionEffect.
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
@ TAE_MAIL
Cargo behaves mail-like.
bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
uint16_t multiplier
Capacity multiplier for vehicles. (8 fractional bits)
@ TAE_PASSENGERS
Cargo behaves passenger-like.
Dynamic data of a loaded NewGRF.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.
uint16_t classes
Classes of this cargo type.
TownAcceptanceEffect town_acceptance_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies.