Call UpdateScheduledDispatch() at first waiting, even when not travelling.

This is so that the schedule start point is advanced if a train
arrives at the first waiting point before but leaves at or after the
schedule end time.
This commit is contained in:
Jonathan G Rennison
2017-05-31 19:03:25 +01:00
parent e7a2907a9b
commit 4528004bb8

View File

@@ -872,10 +872,12 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
v->current_order_time = 0;
v->current_loading_time = 0;
} else if (HasBit(v->vehicle_flags, VF_SCHEDULED_DISPATCH) && HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
if (IsVehicleAtFirstWaitingLocation(v) && travelling) {
const bool is_first_waiting = IsVehicleAtFirstWaitingLocation(v);
if (is_first_waiting) {
/* Update scheduled information */
v->orders.list->UpdateScheduledDispatch();
}
if (is_first_waiting && travelling) {
DateTicksScaled slot = GetScheduledDispatchTime(v);
if (slot > -1) {
v->lateness_counter = _scaled_date_ticks - slot;