Changeset - r19249:380595c90b2b
[Not reviewed]
master
0 1 0
rubidium - 12 years ago 2012-04-18 19:21:54
rubidium@openttd.org
(svn r24152) -Fix [FS#5157]: [NoAI] Do not return the last 'cached' speed of vehicles when they are stopped/crashed
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_vehicle.cpp
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)