OpenTTD AI API 20241220-master-g59680867c3
|
Class that handles all cargo related functions. More...
#include <script_cargo.hpp>
Public Types | |
enum | CargoClass { CC_PASSENGERS , CC_MAIL , CC_EXPRESS , CC_ARMOURED , CC_BULK , CC_PIECE_GOODS , CC_LIQUID , CC_REFRIGERATED , CC_HAZARDOUS , CC_COVERED } |
The classes of cargo. More... | |
enum | TownEffect { TE_NONE , TE_PASSENGERS , TE_MAIL , TE_GOODS , TE_WATER , TE_FOOD } |
The effects a cargo can have on a town. More... | |
enum | SpecialCargoID { CT_AUTO_REFIT , CT_NO_REFIT , CT_INVALID } |
Special cargo types. More... | |
enum | DistributionType { DT_MANUAL , DT_ASYMMETRIC , DT_SYMMETRIC , INVALID_DISTRIBUTION_TYPE } |
Type of cargo distribution. More... | |
Static Public Member Functions | |
static bool | IsValidCargo (CargoID cargo_type) |
Checks whether the given cargo type is valid. | |
static bool | IsValidTownEffect (TownEffect towneffect_type) |
Checks whether the given town effect type is valid. | |
static string | GetName (CargoID cargo_type) |
Get the name of the cargo type. | |
static string | GetCargoLabel (CargoID cargo_type) |
Gets the string representation of the cargo label. | |
static bool | IsFreight (CargoID cargo_type) |
Checks whether the give cargo is a freight or not. | |
static bool | HasCargoClass (CargoID cargo_type, CargoClass cargo_class) |
Check if this cargo is in the requested cargo class. | |
static TownEffect | GetTownEffect (CargoID cargo_type) |
Get the effect this cargo has on a town. | |
static Money | GetCargoIncome (CargoID cargo_type, int distance, int days_in_transit) |
Get the income for transporting a piece of cargo over the given distance within the specified time. | |
static DistributionType | GetDistributionType (CargoID cargo_type) |
Get the cargo distribution type for a cargo. | |
static int | GetWeight (CargoID cargo_type, int amount) |
Get the weight in tonnes for the given amount of cargo for the specified type. | |
Class that handles all cargo related functions.
enum AICargo::CargoClass |
The classes of cargo.
Type of cargo distribution.
enum AICargo::TownEffect |
The effects a cargo can have on a town.
|
static |
Get the income for transporting a piece of cargo over the given distance within the specified time.
cargo_type | The cargo to transport. |
distance | The distance the cargo travels from begin to end. The value will be clamped to 0 .. MAX(int). |
days_in_transit | Amount of (game) days the cargo is in transit. The max value of this variable is 637. Any value higher returns the same as 637 would. |
|
static |
Gets the string representation of the cargo label.
cargo_type | The cargo to get the string representation of. |
|
static |
Get the cargo distribution type for a cargo.
cargo_type | The cargo to check on. |
|
static |
Get the name of the cargo type.
cargo_type | The cargo type to get the name of. |
|
static |
Get the effect this cargo has on a town.
cargo_type | The cargo to check on. |
|
static |
Get the weight in tonnes for the given amount of cargo for the specified type.
cargo_type | The cargo to check on. |
amount | The quantity of cargo. The value will be clamped to 0 .. MAX(int). |
|
static |
Check if this cargo is in the requested cargo class.
cargo_type | The cargo to check on. |
cargo_class | The class to check for. |
|
static |
Checks whether the give cargo is a freight or not.
This defines whether the "freight train weight multiplier" will apply to trains transporting this cargo.
cargo_type | The cargo to check on. |
|
static |
Checks whether the given cargo type is valid.
cargo_type | The cargo to check. |
|
static |
Checks whether the given town effect type is valid.
towneffect_type | The town effect to check. |