Public Types | |
enum | ErrorMessages { ERR_VEHICLE_BASE, ERR_VEHICLE_TOO_MANY, ERR_VEHICLE_NOT_AVAILABLE, ERR_VEHICLE_BUILD_DISABLED, ERR_VEHICLE_WRONG_DEPOT, ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, ERR_VEHICLE_CANNOT_START_STOP, ERR_VEHICLE_CANNOT_TURN, ERR_VEHICLE_CANNOT_REFIT, ERR_VEHICLE_IS_DESTROYED, ERR_VEHICLE_NOT_IN_DEPOT, ERR_VEHICLE_IN_FLIGHT, ERR_VEHICLE_NO_POWER, ERR_VEHICLE_TOO_LONG } |
All vehicle related error messages. More... | |
enum | VehicleType { VT_RAIL, VT_ROAD, VT_WATER, VT_AIR, VT_INVALID } |
The type of a vehicle available in the game. More... | |
enum | VehicleState { VS_RUNNING, VS_STOPPED, VS_IN_DEPOT, VS_AT_STATION, VS_BROKEN, VS_CRASHED, VS_INVALID } |
The different states a vehicle can be in. More... | |
Static Public Member Functions | |
static bool | IsValidVehicle (VehicleID vehicle_id) |
Checks whether the given vehicle is valid and owned by you. | |
static int32 | GetNumWagons (VehicleID vehicle_id) |
Get the number of wagons a vehicle has. | |
static bool | SetName (VehicleID vehicle_id, Text *name) |
Set the name of a vehicle. | |
static char * | GetName (VehicleID vehicle_id) |
Get the name of a vehicle. | |
static GSCompany::CompanyID | GetOwner (VehicleID vehicle_id) |
Get the owner of a vehicle. | |
static TileIndex | GetLocation (VehicleID vehicle_id) |
Get the current location of a vehicle. | |
static EngineID | GetEngineType (VehicleID vehicle_id) |
Get the engine-type of a vehicle. | |
static EngineID | GetWagonEngineType (VehicleID vehicle_id, int wagon) |
Get the engine-type of a wagon. | |
static int32 | GetUnitNumber (VehicleID vehicle_id) |
Get the unitnumber of a vehicle. | |
static int32 | GetAge (VehicleID vehicle_id) |
Get the current age of a vehicle. | |
static int32 | GetWagonAge (VehicleID vehicle_id, int wagon) |
Get the current age of a second (or third, etc. | |
static int32 | GetMaxAge (VehicleID vehicle_id) |
Get the maximum age of a vehicle. | |
static int32 | GetAgeLeft (VehicleID vehicle_id) |
Get the age a vehicle has left (maximum - current). | |
static int32 | GetCurrentSpeed (VehicleID vehicle_id) |
Get the current speed of a vehicle. | |
static VehicleState | GetState (VehicleID vehicle_id) |
Get the current state of a vehicle. | |
static Money | GetRunningCost (VehicleID vehicle_id) |
Get the running cost of this vehicle. | |
static Money | GetProfitThisYear (VehicleID vehicle_id) |
Get the current profit of a vehicle. | |
static Money | GetProfitLastYear (VehicleID vehicle_id) |
Get the profit of last year of a vehicle. | |
static Money | GetCurrentValue (VehicleID vehicle_id) |
Get the current value of a vehicle. | |
static GSVehicle::VehicleType | GetVehicleType (VehicleID vehicle_id) |
Get the type of vehicle. | |
static GSRoad::RoadType | GetRoadType (VehicleID vehicle_id) |
Get the RoadType of the vehicle. | |
static bool | IsInDepot (VehicleID vehicle_id) |
Check if a vehicle is in a depot. | |
static bool | IsStoppedInDepot (VehicleID vehicle_id) |
Check if a vehicle is in a depot and stopped. | |
static VehicleID | BuildVehicle (TileIndex depot, EngineID engine_id) |
Builds a vehicle with the given engine at the given depot. | |
static VehicleID | CloneVehicle (TileIndex depot, VehicleID vehicle_id, bool share_orders) |
Clones a vehicle at the given depot, copying or cloning its orders. | |
static bool | MoveWagon (VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon) |
Move a wagon after another wagon. | |
static bool | MoveWagonChain (VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon) |
Move a chain of wagons after another wagon. | |
static int | GetRefitCapacity (VehicleID vehicle_id, CargoID cargo) |
Gets the capacity of the given vehicle when refitted to the given cargo type. | |
static bool | RefitVehicle (VehicleID vehicle_id, CargoID cargo) |
Refits a vehicle to the given cargo type. | |
static bool | SellVehicle (VehicleID vehicle_id) |
Sells the given vehicle. | |
static bool | SellWagon (VehicleID vehicle_id, int wagon) |
Sells the given wagon from the vehicle. | |
static bool | SellWagonChain (VehicleID vehicle_id, int wagon) |
Sells all wagons from the vehicle starting from a given position. | |
static bool | SendVehicleToDepot (VehicleID vehicle_id) |
Sends the given vehicle to a depot. | |
static bool | SendVehicleToDepotForServicing (VehicleID vehicle_id) |
Sends the given vehicle to a depot for servicing. | |
static bool | StartStopVehicle (VehicleID vehicle_id) |
Starts or stops the given vehicle depending on the current state. | |
static bool | ReverseVehicle (VehicleID vehicle_id) |
Turn the given vehicle so it'll drive the other way. | |
static int32 | GetCapacity (VehicleID vehicle_id, CargoID cargo) |
Get the maximum amount of a specific cargo the given vehicle can transport. | |
static int | GetLength (VehicleID vehicle_id) |
Get the length of a the total vehicle in 1/16's of a tile. | |
static int32 | GetCargoLoad (VehicleID vehicle_id, CargoID cargo) |
Get the amount of a specific cargo the given vehicle is transporting. | |
static GroupID | GetGroupID (VehicleID vehicle_id) |
Get the group of a given vehicle. | |
static bool | IsArticulated (VehicleID vehicle_id) |
Check if the vehicle is articulated. | |
static bool | HasSharedOrders (VehicleID vehicle_id) |
Check if the vehicle has shared orders. | |
static int | GetReliability (VehicleID vehicle_id) |
Get the current reliability of a vehicle. | |
static uint | GetMaximumOrderDistance (VehicleID vehicle_id) |
Get the maximum allowed distance between two orders for a vehicle. | |
Static Public Attributes | |
static const VehicleID | VEHICLE_INVALID = 0xFFFFF |
Invalid VehicleID. |
All vehicle related error messages.
The different states a vehicle can be in.
static bool GSVehicle::IsValidVehicle | ( | VehicleID | vehicle_id | ) | [static] |
Checks whether the given vehicle is valid and owned by you.
vehicle_id | The vehicle to check. |
static int32 GSVehicle::GetNumWagons | ( | VehicleID | vehicle_id | ) | [static] |
Get the number of wagons a vehicle has.
vehicle_id | The vehicle to get the number of wagons from. |
static bool GSVehicle::SetName | ( | VehicleID | vehicle_id, | |
Text * | name | |||
) | [static] |
Set the name of a vehicle.
vehicle_id | The vehicle to set the name for. | |
name | The name for the vehicle (can be either a raw string, or a GSText object). |
name != NULL && len(name) != 0.
Valid GSCompanyMode active in scope.
GSError::ERR_NAME_IS_NOT_UNIQUE |
static char* GSVehicle::GetName | ( | VehicleID | vehicle_id | ) | [static] |
Get the name of a vehicle.
vehicle_id | The vehicle to get the name of. |
static GSCompany::CompanyID GSVehicle::GetOwner | ( | VehicleID | vehicle_id | ) | [static] |
Get the owner of a vehicle.
vehicle_id | The vehicle to get the owner of. |
static TileIndex GSVehicle::GetLocation | ( | VehicleID | vehicle_id | ) | [static] |
Get the current location of a vehicle.
vehicle_id | The vehicle to get the location of. |
static EngineID GSVehicle::GetEngineType | ( | VehicleID | vehicle_id | ) | [static] |
Get the engine-type of a vehicle.
vehicle_id | The vehicle to get the engine-type of. |
static EngineID GSVehicle::GetWagonEngineType | ( | VehicleID | vehicle_id, | |
int | wagon | |||
) | [static] |
Get the engine-type of a wagon.
vehicle_id | The vehicle to get the engine-type of. | |
wagon | The wagon in the vehicle to get the engine-type of. |
wagon < GetNumWagons(vehicle_id).
static int32 GSVehicle::GetUnitNumber | ( | VehicleID | vehicle_id | ) | [static] |
Get the unitnumber of a vehicle.
vehicle_id | The vehicle to get the unitnumber of. |
static int32 GSVehicle::GetAge | ( | VehicleID | vehicle_id | ) | [static] |
Get the current age of a vehicle.
vehicle_id | The vehicle to get the age of. |
static int32 GSVehicle::GetWagonAge | ( | VehicleID | vehicle_id, | |
int | wagon | |||
) | [static] |
Get the current age of a second (or third, etc.
) engine in a train vehicle.
vehicle_id | The vehicle to get the age of. | |
wagon | The wagon in the vehicle to get the age of. |
wagon < GetNumWagons(vehicle_id).
static int32 GSVehicle::GetMaxAge | ( | VehicleID | vehicle_id | ) | [static] |
Get the maximum age of a vehicle.
vehicle_id | The vehicle to get the age of. |
static int32 GSVehicle::GetAgeLeft | ( | VehicleID | vehicle_id | ) | [static] |
Get the age a vehicle has left (maximum - current).
vehicle_id | The vehicle to get the age of. |
static int32 GSVehicle::GetCurrentSpeed | ( | VehicleID | vehicle_id | ) | [static] |
Get the current speed of a vehicle.
vehicle_id | The vehicle to get the speed of. |
static VehicleState GSVehicle::GetState | ( | VehicleID | vehicle_id | ) | [static] |
Get the current state of a vehicle.
vehicle_id | The vehicle to get the state of. |
static Money GSVehicle::GetRunningCost | ( | VehicleID | vehicle_id | ) | [static] |
Get the running cost of this vehicle.
vehicle_id | The vehicle to get the running cost of. |
This is not equal to GSEngine::GetRunningCost for Trains, because wagons and second engines can add up in the calculation too.
static Money GSVehicle::GetProfitThisYear | ( | VehicleID | vehicle_id | ) | [static] |
Get the current profit of a vehicle.
vehicle_id | The vehicle to get the profit of. |
static Money GSVehicle::GetProfitLastYear | ( | VehicleID | vehicle_id | ) | [static] |
Get the profit of last year of a vehicle.
vehicle_id | The vehicle to get the profit of. |
static Money GSVehicle::GetCurrentValue | ( | VehicleID | vehicle_id | ) | [static] |
Get the current value of a vehicle.
vehicle_id | The vehicle to get the value of. |
static GSVehicle::VehicleType GSVehicle::GetVehicleType | ( | VehicleID | vehicle_id | ) | [static] |
Get the type of vehicle.
vehicle_id | The vehicle to get the type of. |
static GSRoad::RoadType GSVehicle::GetRoadType | ( | VehicleID | vehicle_id | ) | [static] |
Get the RoadType of the vehicle.
vehicle_id | The vehicle to get the RoadType of. |
GetVehicleType(vehicle_id) == VT_ROAD.
static bool GSVehicle::IsInDepot | ( | VehicleID | vehicle_id | ) | [static] |
Check if a vehicle is in a depot.
vehicle_id | The vehicle to check. |
static bool GSVehicle::IsStoppedInDepot | ( | VehicleID | vehicle_id | ) | [static] |
Check if a vehicle is in a depot and stopped.
vehicle_id | The vehicle to check. |
static VehicleID GSVehicle::BuildVehicle | ( | TileIndex | depot, | |
EngineID | engine_id | |||
) | [static] |
Builds a vehicle with the given engine at the given depot.
depot | The depot where the vehicle will be build. | |
engine_id | The engine to use for this vehicle. |
GSEngine::IsBuildable(engine_id).
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_TOO_MANY | ||
GSVehicle::ERR_VEHICLE_BUILD_DISABLED | ||
GSVehicle::ERR_VEHICLE_WRONG_DEPOT |
static VehicleID GSVehicle::CloneVehicle | ( | TileIndex | depot, | |
VehicleID | vehicle_id, | |||
bool | share_orders | |||
) | [static] |
Clones a vehicle at the given depot, copying or cloning its orders.
depot | The depot where the vehicle will be build. | |
vehicle_id | The vehicle to use as example for the new vehicle. | |
share_orders | Should the orders be copied or shared? |
IsValidVehicle(vehicle_id).
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_TOO_MANY | ||
GSVehicle::ERR_VEHICLE_BUILD_DISABLED | ||
GSVehicle::ERR_VEHICLE_WRONG_DEPOT |
static bool GSVehicle::MoveWagon | ( | VehicleID | source_vehicle_id, | |
int | source_wagon, | |||
int | dest_vehicle_id, | |||
int | dest_wagon | |||
) | [static] |
Move a wagon after another wagon.
source_vehicle_id | The vehicle to move a wagon away from. | |
source_wagon | The wagon in source_vehicle to move. | |
dest_vehicle_id | The vehicle to move the wagon to, or -1 to create a new vehicle. | |
dest_wagon | The wagon in dest_vehicle to place source_wagon after. |
source_wagon < GetNumWagons(source_vehicle_id).
dest_vehicle_id == -1 || (IsValidVehicle(dest_vehicle_id) && dest_wagon < GetNumWagons(dest_vehicle_id)).
GetVehicleType(source_vehicle_id) == VT_RAIL.
dest_vehicle_id == -1 || GetVehicleType(dest_vehicle_id) == VT_RAIL.
Valid GSCompanyMode active in scope.
static bool GSVehicle::MoveWagonChain | ( | VehicleID | source_vehicle_id, | |
int | source_wagon, | |||
int | dest_vehicle_id, | |||
int | dest_wagon | |||
) | [static] |
Move a chain of wagons after another wagon.
source_vehicle_id | The vehicle to move a wagon away from. | |
source_wagon | The first wagon in source_vehicle to move. | |
dest_vehicle_id | The vehicle to move the wagons to, or -1 to create a new vehicle. | |
dest_wagon | The wagon in dest_vehicle to place source_wagon and following wagons after. |
source_wagon < GetNumWagons(source_vehicle_id).
dest_vehicle_id == -1 || (IsValidVehicle(dest_vehicle_id) && dest_wagon < GetNumWagons(dest_vehicle_id)).
GetVehicleType(source_vehicle_id) == VT_RAIL.
dest_vehicle_id == -1 || GetVehicleType(dest_vehicle_id) == VT_RAIL.
Valid GSCompanyMode active in scope.
static int GSVehicle::GetRefitCapacity | ( | VehicleID | vehicle_id, | |
CargoID | cargo | |||
) | [static] |
Gets the capacity of the given vehicle when refitted to the given cargo type.
vehicle_id | The vehicle to refit. | |
cargo | The cargo to refit to. |
GSCargo::IsValidCargo(cargo).
You must own the vehicle.
The vehicle must be stopped in the depot.
static bool GSVehicle::RefitVehicle | ( | VehicleID | vehicle_id, | |
CargoID | cargo | |||
) | [static] |
Refits a vehicle to the given cargo type.
vehicle_id | The vehicle to refit. | |
cargo | The cargo to refit to. |
GSCargo::IsValidCargo(cargo).
You must own the vehicle.
The vehicle must be stopped in the depot.
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_CANNOT_REFIT | ||
GSVehicle::ERR_VEHICLE_IS_DESTROYED | ||
GSVehicle::ERR_VEHICLE_NOT_IN_DEPOT |
static bool GSVehicle::SellVehicle | ( | VehicleID | vehicle_id | ) | [static] |
Sells the given vehicle.
vehicle_id | The vehicle to sell. |
You must own the vehicle.
The vehicle must be stopped in the depot.
Valid GSCompanyMode active in scope.
static bool GSVehicle::SellWagon | ( | VehicleID | vehicle_id, | |
int | wagon | |||
) | [static] |
Sells the given wagon from the vehicle.
vehicle_id | The vehicle to sell a wagon from. | |
wagon | The wagon to sell. |
wagon < GetNumWagons(vehicle_id).
You must own the vehicle.
The vehicle must be stopped in the depot.
Valid GSCompanyMode active in scope.
static bool GSVehicle::SellWagonChain | ( | VehicleID | vehicle_id, | |
int | wagon | |||
) | [static] |
Sells all wagons from the vehicle starting from a given position.
vehicle_id | The vehicle to sell a wagon from. | |
wagon | The wagon to sell. |
wagon < GetNumWagons(vehicle_id).
You must own the vehicle.
The vehicle must be stopped in the depot.
Valid GSCompanyMode active in scope.
static bool GSVehicle::SendVehicleToDepot | ( | VehicleID | vehicle_id | ) | [static] |
Sends the given vehicle to a depot.
If the vehicle has already been sent to a depot it continues with its normal orders instead.
vehicle_id | The vehicle to send to a depot. |
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT |
static bool GSVehicle::SendVehicleToDepotForServicing | ( | VehicleID | vehicle_id | ) | [static] |
Sends the given vehicle to a depot for servicing.
If the vehicle has already been sent to a depot it continues with its normal orders instead.
vehicle_id | The vehicle to send to a depot for servicing. |
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT |
static bool GSVehicle::StartStopVehicle | ( | VehicleID | vehicle_id | ) | [static] |
Starts or stops the given vehicle depending on the current state.
vehicle_id | The vehicle to start/stop. |
Valid GSCompanyMode active in scope.
GSVehicle::ERR_VEHICLE_CANNOT_START_STOP | ||
(For | aircraft only): GSVehicle::ERR_VEHICLE_IN_FLIGHT | |
(For | trains only): GSVehicle::ERR_VEHICLE_NO_POWER |
static bool GSVehicle::ReverseVehicle | ( | VehicleID | vehicle_id | ) | [static] |
Turn the given vehicle so it'll drive the other way.
vehicle_id | The vehicle to turn. |
GetVehicleType(vehicle_id) == VT_ROAD || GetVehicleType(vehicle_id) == VT_RAIL.
Valid GSCompanyMode active in scope.
static int32 GSVehicle::GetCapacity | ( | VehicleID | vehicle_id, | |
CargoID | cargo | |||
) | [static] |
Get the maximum amount of a specific cargo the given vehicle can transport.
vehicle_id | The vehicle to get the capacity of. | |
cargo | The cargo to get the capacity for. |
GSCargo::IsValidCargo(cargo).
static int GSVehicle::GetLength | ( | VehicleID | vehicle_id | ) | [static] |
Get the length of a the total vehicle in 1/16's of a tile.
vehicle_id | The vehicle to get the length of. |
GetVehicleType(vehicle_id) == VT_ROAD || GetVehicleType(vehicle_id) == VT_RAIL.
static int32 GSVehicle::GetCargoLoad | ( | VehicleID | vehicle_id, | |
CargoID | cargo | |||
) | [static] |
Get the amount of a specific cargo the given vehicle is transporting.
vehicle_id | The vehicle to get the load amount of. | |
cargo | The cargo to get the loaded amount for. |
GSCargo::IsValidCargo(cargo).
static GroupID GSVehicle::GetGroupID | ( | VehicleID | vehicle_id | ) | [static] |
Get the group of a given vehicle.
vehicle_id | The vehicle to get the group from. |
static bool GSVehicle::IsArticulated | ( | VehicleID | vehicle_id | ) | [static] |
Check if the vehicle is articulated.
vehicle_id | The vehicle to check. |
GetVehicleType(vehicle_id) == VT_ROAD || GetVehicleType(vehicle_id) == VT_RAIL.
static bool GSVehicle::HasSharedOrders | ( | VehicleID | vehicle_id | ) | [static] |
Check if the vehicle has shared orders.
vehicle_id | The vehicle to check. |
static int GSVehicle::GetReliability | ( | VehicleID | vehicle_id | ) | [static] |
Get the current reliability of a vehicle.
vehicle_id | The vehicle to check. |
static uint GSVehicle::GetMaximumOrderDistance | ( | VehicleID | vehicle_id | ) | [static] |
Get the maximum allowed distance between two orders for a vehicle.
The distance returned is a vehicle-type specific distance independent from other map distances, you may use the result of this function to compare it with the result of GSOrder::GetOrderDistance.
vehicle_id | The vehicle to get the distance for. |