From 5656322434750981dce2c5e23ae51036659d7341 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 13 Nov 2023 22:35:51 +0000 Subject: [PATCH] Fix vehicle lateness updates when using timetabled 0 wait times --- src/timetable_cmd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 7eb6e272eb..c27bad1c08 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -1010,10 +1010,13 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) } } + bool is_timetabled = travel_field ? real_timetable_order->IsTravelTimetabled() : + real_timetable_order->IsWaitTimetabled(); + /* Vehicles will wait at stations if they arrive early even if they are not * timetabled to wait there, so make sure the lateness counter is updated * when this happens. */ - if (timetabled == 0 && (travelling || v->lateness_counter >= 0)) return; + if (timetabled == 0 && !is_timetabled && (travelling || v->lateness_counter >= 0)) return; if (set_scheduled_dispatch) { // do nothing