static */
| 349 | } |
| 350 | |
| 351 | /* static */ ScriptVehicle::VehicleState ScriptVehicle::GetState(VehicleID vehicle_id) |
| 352 | { |
| 353 | if (!IsValidVehicle(vehicle_id)) return ScriptVehicle::VS_INVALID; |
| 354 | |
| 355 | const Vehicle *v = ::Vehicle::Get(vehicle_id); |
| 356 | VehStates vehstatus = v->vehstatus; |
| 357 | |
| 358 | if (vehstatus.Test(::VehState::Crashed)) return ScriptVehicle::VS_CRASHED; |
| 359 | if (v->breakdown_ctr != 0) return ScriptVehicle::VS_BROKEN; |
| 360 | if (v->IsStoppedInDepot()) return ScriptVehicle::VS_IN_DEPOT; |
| 361 | if (vehstatus.Test(::VehState::Stopped)) return ScriptVehicle::VS_STOPPED; |
| 362 | if (v->current_order.IsType(OT_LOADING)) return ScriptVehicle::VS_AT_STATION; |
| 363 | return ScriptVehicle::VS_RUNNING; |
| 364 | } |
| 365 | |
| 366 | /* static */ Money ScriptVehicle::GetRunningCost(VehicleID vehicle_id) |
| 367 | { |
no test coverage detected