summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script/api/script_vehicle.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script/api/script_vehicle.cpp b/src/script/api/script_vehicle.cpp
index b6a28af4f..c4c6ca590 100644
--- a/src/script/api/script_vehicle.cpp
+++ b/src/script/api/script_vehicle.cpp
@@ -311,7 +311,8 @@
{
if (!IsValidVehicle(vehicle_id)) return -1;
- return ::Vehicle::Get(vehicle_id)->GetDisplaySpeed(); // km-ish/h
+ const ::Vehicle *v = ::Vehicle::Get(vehicle_id);
+ return (v->vehstatus & (::VS_STOPPED | ::VS_CRASHED)) == 0 ? v->GetDisplaySpeed() : 0; // km-ish/h
}
/* static */ ScriptVehicle::VehicleState ScriptVehicle::GetState(VehicleID vehicle_id)