(svn r24152) -Fix [FS#5157]: [NoAI] Do not return the last 'cached' speed of vehicles when they are stopped/crashed

This commit is contained in:
rubidium
2012-04-18 19:21:54 +00:00
parent 16478a4374
commit bb8ec1d813

View File

@@ -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)