| 411 | } |
| 412 | |
| 413 | static void CheckIfAircraftNeedsService(Aircraft *v) |
| 414 | { |
| 415 | if (Company::Get(v->owner)->settings.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return; |
| 416 | if (v->IsChainInDepot()) { |
| 417 | VehicleServiceInDepot(v); |
| 418 | return; |
| 419 | } |
| 420 | |
| 421 | /* When we're parsing conditional orders and the like |
| 422 | * we don't want to consider going to a depot too. */ |
| 423 | if (!v->current_order.IsType(OT_GOTO_DEPOT) && !v->current_order.IsType(OT_GOTO_STATION)) return; |
| 424 | |
| 425 | const Station *st = Station::Get(v->current_order.GetDestination().ToStationID()); |
| 426 | |
| 427 | assert(st != nullptr); |
| 428 | |
| 429 | /* only goto depot if the target airport has a depot */ |
| 430 | if (st->airport.HasHangar() && CanVehicleUseStation(v, st)) { |
| 431 | v->current_order.MakeGoToDepot(st->index, OrderDepotTypeFlag::Service); |
| 432 | SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); |
| 433 | } else if (v->current_order.IsType(OT_GOTO_DEPOT)) { |
| 434 | v->current_order.MakeDummy(); |
| 435 | SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | Money Aircraft::GetRunningCost() const |
| 440 | { |
no test coverage detected