equal
deleted
inserted
replaced
2632 { |
2632 { |
2633 switch (v->current_order.type) { |
2633 switch (v->current_order.type) { |
2634 case OT_GOTO_DEPOT: |
2634 case OT_GOTO_DEPOT: |
2635 if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false; |
2635 if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false; |
2636 if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) && |
2636 if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) && |
2637 !VehicleNeedsService(v)) { |
2637 !v->NeedsServicing()) { |
2638 UpdateVehicleTimetable(v, true); |
2638 UpdateVehicleTimetable(v, true); |
2639 v->cur_order_index++; |
2639 v->cur_order_index++; |
2640 } |
2640 } |
2641 break; |
2641 break; |
2642 |
2642 |
3525 DiagDirection dir = TrainExitDir(v->direction, v->u.rail.track); |
3525 DiagDirection dir = TrainExitDir(v->direction, v->u.rail.track); |
3526 /* Calculate next tile */ |
3526 /* Calculate next tile */ |
3527 TileIndex tile = v->tile + TileOffsByDiagDir(dir); |
3527 TileIndex tile = v->tile + TileOffsByDiagDir(dir); |
3528 |
3528 |
3529 /* Determine the track status on the next tile */ |
3529 /* Determine the track status on the next tile */ |
3530 TrackStatus ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0, ReverseDiagDir(dir)) & _reachable_tracks[dir]; |
3530 ; TrackStatus ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0, ReverseDiagDir(dir)) & _reachable_tracks[dir]; |
3531 TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts); |
3531 TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts); |
3532 TrackdirBits red_signals = TrackStatusToRedSignals(ts); |
3532 TrackdirBits red_signals = TrackStatusToRedSignals(ts); |
3533 |
3533 |
3534 /* We are sure the train is not entering a depot, it is detected above */ |
3534 /* We are sure the train is not entering a depot, it is detected above */ |
3535 |
3535 |
3663 |
3663 |
3664 #define MAX_ACCEPTABLE_DEPOT_DIST 16 |
3664 #define MAX_ACCEPTABLE_DEPOT_DIST 16 |
3665 |
3665 |
3666 static void CheckIfTrainNeedsService(Vehicle *v) |
3666 static void CheckIfTrainNeedsService(Vehicle *v) |
3667 { |
3667 { |
3668 if (_patches.servint_trains == 0 || !VehicleNeedsService(v)) return; |
3668 if (_patches.servint_trains == 0 || !v->NeedsAutomaticServicing()) return; |
3669 if (v->IsInDepot()) { |
3669 if (v->IsInDepot()) { |
3670 VehicleServiceInDepot(v); |
3670 VehicleServiceInDepot(v); |
3671 return; |
3671 return; |
3672 } |
3672 } |
3673 |
3673 |