MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetLength

Method GetLength

src/script/api/script_vehicle.cpp:67–73  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

65}
66
67/* static */ SQInteger ScriptVehicle::GetLength(VehicleID vehicle_id)
68{
69 if (!IsValidVehicle(vehicle_id)) return -1;
70
71 const Vehicle *v = ::Vehicle::Get(vehicle_id);
72 return v->IsGroundVehicle() ? v->GetGroundVehicleCache()->cached_total_length : -1;
73}
74
75/* static */ VehicleID ScriptVehicle::_BuildVehicleInternal(TileIndex depot, EngineID engine_id, CargoType cargo)
76{

Callers 1

OneTileCostMethod · 0.45

Calls 2

GetGroundVehicleCacheMethod · 0.80
IsGroundVehicleMethod · 0.45

Tested by

no test coverage detected