mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 03:56:43 +00:00
(svn r24226) [1.2] -Backport from trunk:
- Fix: [Squirrel] Crash when trying to create an array with negative size [FS#5160] (r24153) - Fix: [NoAI] Do not return the last 'cached' speed of vehicles when they are stopped/crashed [FS#5157] (r24152) - Fix: [Script] Typo in script documentation (r24151) - Fix: Glass-sprite of bubble-generator was not drawn anymore for completely constructed tiles [FS#5143] (r24107)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get the current speed of a vehicle.
|
||||
* @param vehicle_id The vehicle to get the age of.
|
||||
* @param vehicle_id The vehicle to get the speed of.
|
||||
* @pre IsValidVehicle(vehicle_id).
|
||||
* @return The current speed of the vehicle.
|
||||
* @note The speed is in OpenTTD's internal speed unit.
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get the running cost of this vehicle.
|
||||
* @param vehicle_id The vehicle to get the age of.
|
||||
* @param vehicle_id The vehicle to get the running cost of.
|
||||
* @pre IsValidVehicle(vehicle_id).
|
||||
* @return The running cost of the vehicle per year.
|
||||
* @note Cost is per year; divide by 365 to get per day.
|
||||
|
||||
Reference in New Issue
Block a user