Class that handles all industry related functions. More...
#include <script_industry.hpp>
Public Types | |
enum | CargoAcceptState { CAS_NOT_ACCEPTED, CAS_ACCEPTED, CAS_TEMP_REFUSED } |
Ways for an industry to accept a cargo. More... | |
Static Public Member Functions | |
static int32 | GetIndustryCount () |
Gets the number of industries. | |
static bool | IsValidIndustry (IndustryID industry_id) |
Checks whether the given industry index is valid. | |
static IndustryID | GetIndustryID (TileIndex tile) |
Get the IndustryID of a tile, if there is an industry. | |
static char * | GetName (IndustryID industry_id) |
Get the name of the industry. | |
static CargoAcceptState | IsCargoAccepted (IndustryID industry_id, CargoID cargo_id) |
See whether an industry currently accepts a certain cargo. | |
static int32 | GetStockpiledCargo (IndustryID industry_id, CargoID cargo_id) |
Get the amount of cargo stockpiled for processing. | |
static int32 | GetLastMonthProduction (IndustryID industry_id, CargoID cargo_id) |
Get the total last month's production of the given cargo at an industry. | |
static int32 | GetLastMonthTransported (IndustryID industry_id, CargoID cargo_id) |
Get the total amount of cargo transported from an industry last month. | |
static int32 | GetLastMonthTransportedPercentage (IndustryID industry_id, CargoID cargo_id) |
Get the percentage of cargo transported from an industry last month. | |
static TileIndex | GetLocation (IndustryID industry_id) |
Gets the location of the industry. | |
static int32 | GetAmountOfStationsAround (IndustryID industry_id) |
Get the number of stations around an industry. | |
static int32 | GetDistanceManhattanToTile (IndustryID industry_id, TileIndex tile) |
Get the manhattan distance from the tile to the ScriptIndustry::GetLocation() of the industry. | |
static int32 | GetDistanceSquareToTile (IndustryID industry_id, TileIndex tile) |
Get the square distance from the tile to the ScriptIndustry::GetLocation() of the industry. | |
static bool | IsBuiltOnWater (IndustryID industry_id) |
Is this industry built on water. | |
static bool | HasHeliport (IndustryID industry_id) |
Does this industry have a heliport? | |
static TileIndex | GetHeliportLocation (IndustryID industry_id) |
Gets the location of the industry's heliport. | |
static bool | HasDock (IndustryID industry_id) |
Does this industry have a dock? | |
static TileIndex | GetDockLocation (IndustryID industry_id) |
Gets the location of the industry's dock. | |
static IndustryType | GetIndustryType (IndustryID industry_id) |
Get the IndustryType of the industry. |
Class that handles all industry related functions.
ai
Definition at line 21 of file script_industry.hpp.
Ways for an industry to accept a cargo.
Definition at line 24 of file script_industry.hpp.
int32 ScriptIndustry::GetAmountOfStationsAround | ( | IndustryID | industry_id | ) | [static] |
Get the number of stations around an industry.
All stations that can service the industry are counted, your own stations but also your opponents stations.
industry_id | The index of the industry. |
Definition at line 132 of file script_industry.cpp.
References FindStationsAroundTiles(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), IsValidIndustry(), and Industry::location.
int32 ScriptIndustry::GetDistanceManhattanToTile | ( | IndustryID | industry_id, | |
TileIndex | tile | |||
) | [static] |
Get the manhattan distance from the tile to the ScriptIndustry::GetLocation() of the industry.
industry_id | The industry to get the distance to. | |
tile | The tile to get the distance to. |
Definition at line 142 of file script_industry.cpp.
References DistanceManhattan(), GetLocation(), and IsValidIndustry().
int32 ScriptIndustry::GetDistanceSquareToTile | ( | IndustryID | industry_id, | |
TileIndex | tile | |||
) | [static] |
Get the square distance from the tile to the ScriptIndustry::GetLocation() of the industry.
industry_id | The industry to get the distance to. | |
tile | The tile to get the distance to. |
Definition at line 149 of file script_industry.cpp.
References DistanceSquare(), GetLocation(), and IsValidIndustry().
TileIndex ScriptIndustry::GetDockLocation | ( | IndustryID | industry_id | ) | [static] |
Gets the location of the industry's dock.
industry_id | The index of the industry. |
Definition at line 192 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), HasDock(), INVALID_TILE, IsOilRig(), IsTileType(), IsValidIndustry(), Industry::location, MP_STATION, and TILE_AREA_LOOP.
TileIndex ScriptIndustry::GetHeliportLocation | ( | IndustryID | industry_id | ) | [static] |
Gets the location of the industry's heliport.
industry_id | The index of the industry. |
Definition at line 170 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), HasHeliport(), INVALID_TILE, IsOilRig(), IsTileType(), IsValidIndustry(), Industry::location, MP_STATION, and TILE_AREA_LOOP.
int32 ScriptIndustry::GetIndustryCount | ( | ) | [static] |
Gets the number of industries.
Definition at line 22 of file script_industry.cpp.
IndustryID ScriptIndustry::GetIndustryID | ( | TileIndex | tile | ) | [static] |
Get the IndustryID of a tile, if there is an industry.
tile | The tile to find the IndustryID of. |
Definition at line 32 of file script_industry.cpp.
References GetIndustryIndex(), IsTileType(), IsValidTile(), and MP_INDUSTRY.
IndustryType ScriptIndustry::GetIndustryType | ( | IndustryID | industry_id | ) | [static] |
Get the IndustryType of the industry.
industry_id | The index of the industry. |
Definition at line 207 of file script_industry.cpp.
References INVALID_INDUSTRYTYPE, and IsValidIndustry().
int32 ScriptIndustry::GetLastMonthProduction | ( | IndustryID | industry_id, | |
CargoID | cargo_id | |||
) | [static] |
Get the total last month's production of the given cargo at an industry.
industry_id | The index of the industry. | |
cargo_id | The index of the cargo. |
Definition at line 83 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), ScriptCargo::IsValidCargo(), IsValidIndustry(), Industry::last_month_production, lengthof, and Industry::produced_cargo.
int32 ScriptIndustry::GetLastMonthTransported | ( | IndustryID | industry_id, | |
CargoID | cargo_id | |||
) | [static] |
Get the total amount of cargo transported from an industry last month.
industry_id | The index of the industry. | |
cargo_id | The index of the cargo. |
Definition at line 97 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), ScriptCargo::IsValidCargo(), IsValidIndustry(), Industry::last_month_transported, lengthof, and Industry::produced_cargo.
int32 ScriptIndustry::GetLastMonthTransportedPercentage | ( | IndustryID | industry_id, | |
CargoID | cargo_id | |||
) | [static] |
Get the percentage of cargo transported from an industry last month.
industry_id | The index of the industry. | |
cargo_id | The index of the cargo. |
Definition at line 111 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), ScriptCargo::IsValidCargo(), IsValidIndustry(), Industry::last_month_pct_transported, lengthof, Industry::produced_cargo, and ToPercent8().
TileIndex ScriptIndustry::GetLocation | ( | IndustryID | industry_id | ) | [static] |
Gets the location of the industry.
industry_id | The index of the industry. |
Definition at line 125 of file script_industry.cpp.
References INVALID_TILE, and IsValidIndustry().
Referenced by GetDistanceManhattanToTile(), and GetDistanceSquareToTile().
char * ScriptIndustry::GetName | ( | IndustryID | industry_id | ) | [static] |
Get the name of the industry.
industry_id | The industry to get the name of. |
Definition at line 38 of file script_industry.cpp.
References IsValidIndustry(), and SetDParam().
int32 ScriptIndustry::GetStockpiledCargo | ( | IndustryID | industry_id, | |
CargoID | cargo_id | |||
) | [static] |
Get the amount of cargo stockpiled for processing.
industry_id | The index of the industry. | |
cargo_id | The index of the cargo. |
Definition at line 67 of file script_industry.cpp.
References Industry::accepts_cargo, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), Industry::incoming_cargo_waiting, ScriptCargo::IsValidCargo(), IsValidIndustry(), and lengthof.
bool ScriptIndustry::HasDock | ( | IndustryID | industry_id | ) | [static] |
Does this industry have a dock?
industry_id | The index of the industry. |
Definition at line 185 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), GetIndustrySpec(), INDUSTRYBEH_AI_AIRSHIP_ROUTES, and IsValidIndustry().
Referenced by GetDockLocation().
bool ScriptIndustry::HasHeliport | ( | IndustryID | industry_id | ) | [static] |
Does this industry have a heliport?
industry_id | The index of the industry. |
Definition at line 163 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), GetIndustrySpec(), INDUSTRYBEH_AI_AIRSHIP_ROUTES, and IsValidIndustry().
Referenced by GetHeliportLocation().
bool ScriptIndustry::IsBuiltOnWater | ( | IndustryID | industry_id | ) | [static] |
Is this industry built on water.
industry_id | The index of the industry. |
Definition at line 156 of file script_industry.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), GetIndustrySpec(), INDUSTRYBEH_BUILT_ONWATER, and IsValidIndustry().
ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted | ( | IndustryID | industry_id, | |
CargoID | cargo_id | |||
) | [static] |
See whether an industry currently accepts a certain cargo.
industry_id | The index of the industry. | |
cargo_id | The index of the cargo. |
Definition at line 50 of file script_industry.cpp.
References Industry::accepts_cargo, CAS_TEMP_REFUSED, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), IndustryTemporarilyRefusesCargo(), ScriptCargo::IsValidCargo(), IsValidIndustry(), and lengthof.
bool ScriptIndustry::IsValidIndustry | ( | IndustryID | industry_id | ) | [static] |
Checks whether the given industry index is valid.
industry_id | The index to check. |
Definition at line 27 of file script_industry.cpp.
Referenced by GetAmountOfStationsAround(), GetDistanceManhattanToTile(), GetDistanceSquareToTile(), GetDockLocation(), GetHeliportLocation(), GetIndustryType(), GetLastMonthProduction(), GetLastMonthTransported(), GetLastMonthTransportedPercentage(), GetLocation(), GetName(), GetStockpiledCargo(), HasDock(), HasHeliport(), IsBuiltOnWater(), IsCargoAccepted(), ScriptCargoList_IndustryAccepting::ScriptCargoList_IndustryAccepting(), ScriptCargoList_IndustryProducing::ScriptCargoList_IndustryProducing(), ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(), and ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing().