|
OpenTTD Source
13.2.1
|
#include "stdafx.h"#include "cargotype.h"#include "newgrf_cargo.h"#include "string_func.h"#include "strings_func.h"#include "settings_type.h"#include "table/sprites.h"#include "table/strings.h"#include "table/cargo_const.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| void | SetupCargoForClimate (LandscapeID l) |
| Set up the default cargo types for the given landscape type. More... | |
| CargoID | GetDefaultCargoID (LandscapeID l, CargoType ct) |
| Get the cargo ID of a default cargo, if present. 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... | |
| static bool | CargoSpecNameSorter (const CargoSpec *const &a, const CargoSpec *const &b) |
| Sort cargo specifications by their name. | |
| static bool | CargoSpecClassSorter (const CargoSpec *const &a, const CargoSpec *const &b) |
| Sort cargo specifications by their cargo class. | |
| void | InitializeSortedCargoSpecs () |
| Initialize the list of sorted cargo specifications. | |
Variables | |
| 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. | |
Implementation of cargoes.
Definition in file cargotype.cpp.
| CargoID GetCargoIDByBitnum | ( | uint8 | bitnum | ) |
Find the CargoID of a 'bitnum' value.
| bitnum | 'bitnum' to find. |
Definition at line 124 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 108 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 87 of file cargotype.cpp.
References _default_cargo, _default_climate_cargo, CT_INVALID, GetCargoIDByLabel(), CargoSpec::label, and lengthof.
| void SetupCargoForClimate | ( | LandscapeID | l | ) |
Set up the default cargo types for the given landscape type.
| l | Landscape |
Definition at line 40 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 29 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 34 of file cargotype.cpp.
Referenced by CargoAndEngineFilter(), and InitializeSortedCargoSpecs().