|
OpenTTD Source
12.2
|
#include "economy_type.h"#include "cargo_type.h"#include "gfx_type.h"#include "strings_type.h"#include "landscape_type.h"#include "core/bitmath_func.hpp"#include "core/span_type.hpp"#include <vector>Go to the source code of this file.
Data Structures | |
| struct | CargoSpec |
| Specification of a cargo type. More... | |
| struct | CargoSpec::Iterator |
| Iterator to iterate all valid CargoSpec. More... | |
| struct | CargoSpec::IterateWrapper |
Typedefs | |
| typedef uint32 | CargoLabel |
| Globally unique label of a cargo type. | |
| using | SetCargoBitIterator = SetBitIterator< CargoID, CargoTypes > |
Enumerations | |
| enum | TownEffect { TE_BEGIN = 0, TE_NONE = TE_BEGIN, TE_PASSENGERS, TE_MAIL, TE_GOODS, TE_WATER, TE_FOOD, TE_END, NUM_TE = TE_END } |
| Town growth effect when delivering cargo. More... | |
| enum | CargoClass { CC_NOAVAILABLE = 0, CC_PASSENGERS = 1 << 0, CC_MAIL = 1 << 1, CC_EXPRESS = 1 << 2, CC_ARMOURED = 1 << 3, CC_BULK = 1 << 4, CC_PIECE_GOODS = 1 << 5, CC_LIQUID = 1 << 6, CC_REFRIGERATED = 1 << 7, CC_HAZARDOUS = 1 << 8, CC_COVERED = 1 << 9, CC_SPECIAL = 1 << 15 } |
| Cargo classes. More... | |
Functions | |
| void | SetupCargoForClimate (LandscapeID l) |
| Set up the default cargo types for the given landscape type. More... | |
| CargoID | GetCargoIDByLabel (CargoLabel cl) |
| Get the cargo ID by cargo label. More... | |
| CargoID | GetCargoIDByBitnum (uint8 bitnum) |
| Find the CargoID of a 'bitnum' value. More... | |
| CargoID | GetDefaultCargoID (LandscapeID l, CargoType ct) |
| Get the cargo ID of a default cargo, if present. More... | |
| void | InitializeSortedCargoSpecs () |
| Initialize the list of sorted cargo specifications. | |
| static bool | IsCargoInClass (CargoID c, CargoClass cc) |
| Does cargo c have cargo class cc? More... | |
Variables | |
| static const byte | INVALID_CARGO = 0xFF |
| Constant representing invalid cargo. | |
| CargoTypes | _cargo_mask |
| Bitmask of cargo types available. More... | |
| CargoTypes | _standard_cargo_mask |
| Bitmask of real cargo types available. More... | |
| std::vector< const CargoSpec * > | _sorted_cargo_specs |
| Cargo specifications sorted alphabetically by name. | |
| span< const CargoSpec * > | _sorted_standard_cargo_specs |
| Standard cargo specifications sorted alphabetically by name. | |
Types/functions related to cargoes.
Definition in file cargotype.h.
| enum CargoClass |
Cargo classes.
Definition at line 39 of file cargotype.h.
| enum TownEffect |
Town growth effect when delivering cargo.
Definition at line 26 of file cargotype.h.
| CargoID GetCargoIDByBitnum | ( | uint8 | bitnum | ) |
Find the CargoID of a 'bitnum' value.
| bitnum | 'bitnum' to find. |
Definition at line 123 of file cargotype.cpp.
References CT_INVALID, INVALID_CARGO, and CargoSpec::Iterate().
Referenced by GetCargoTranslation().
| CargoID GetCargoIDByLabel | ( | CargoLabel | cl | ) |
Get the cargo ID by cargo label.
| cl | Cargo type to get. |
Definition at line 107 of file cargotype.cpp.
References CT_INVALID, and CargoSpec::Iterate().
Referenced by GetCargoTranslation(), and GetDefaultCargoID().
| CargoID GetDefaultCargoID | ( | LandscapeID | l, |
| CargoType | ct | ||
| ) |
Get the cargo ID of a default cargo, if present.
| l | Landscape |
| ct | Default cargo type. |
Definition at line 86 of file cargotype.cpp.
References _default_cargo, _default_climate_cargo, CT_INVALID, GetCargoIDByLabel(), CargoSpec::label, and lengthof.
|
inlinestatic |
Does cargo c have cargo class cc?
| c | Cargo type. |
| cc | Cargo class. |
Definition at line 194 of file cargotype.h.
References CargoSpec::Get().
Referenced by Vehicle::Crash(), Engine::DetermineCapacity(), RoadVehicle::IsBus(), and UpdateStationAcceptance().
| void SetupCargoForClimate | ( | LandscapeID | l | ) |
Set up the default cargo types for the given landscape type.
| l | Landscape |
Definition at line 39 of file cargotype.cpp.
References _cargo_mask, _default_cargo, _default_climate_cargo, CargoSpec::array, CargoSpec::bitnum, CargoSpec::Get(), INVALID_CARGO, lengthof, CargoSpec::multiplier, and SetBit().
| CargoTypes _cargo_mask |
Bitmask of cargo types available.
This includes phony cargoes like regearing cargoes. Initialized during a call to SetupCargoForClimate.
Definition at line 28 of file cargotype.cpp.
Referenced by CompanyStationsWindow::OnClick(), and SetupCargoForClimate().
| CargoTypes _standard_cargo_mask |
Bitmask of real cargo types available.
Phony cargoes like regearing cargoes are excluded.
Definition at line 33 of file cargotype.cpp.
Referenced by CargoAndEngineFilter(), and InitializeSortedCargoSpecs().