From e3e743ba1ef4685ba938ef94355c0ce0857225fd Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 3 Apr 2023 20:29:23 +0100 Subject: [PATCH] Skip over dummy/invalid orders in destination prediction and auto-separation --- src/order_cmd.cpp | 11 ++++++++++- src/timetable_cmd.cpp | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 9b9778b7a7..b54cd4e9f7 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -677,7 +677,7 @@ CargoMaskedStationIDStack OrderList::GetNextStoppingStation(const Vehicle *v, Ca }); if (invalid) return CargoMaskedStationIDStack(cargo_mask, INVALID_STATION); } - } while (next->IsType(OT_GOTO_DEPOT) || next->IsType(OT_RELEASE_SLOT) || next->IsType(OT_COUNTER) || next->GetDestination() == v->last_station_visited); + } while (next->IsType(OT_GOTO_DEPOT) || next->IsType(OT_RELEASE_SLOT) || next->IsType(OT_COUNTER) || next->IsType(OT_DUMMY) || next->GetDestination() == v->last_station_visited); return CargoMaskedStationIDStack(cargo_mask, next->GetDestination()); } @@ -3174,6 +3174,9 @@ VehicleOrderID AdvanceOrderIndexDeferred(const Vehicle *v, VehicleOrderID index) break; } + case OT_DUMMY: + break; + default: return index; } @@ -3336,6 +3339,12 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth, bool v->IncrementRealOrderIndex(); break; + case OT_DUMMY: + assert(!pbs_look_ahead); + UpdateVehicleTimetable(v, true); + v->IncrementRealOrderIndex(); + break; + default: v->SetDestTile(0); return false; diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 27cff41982..1b02b53722 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -707,8 +707,8 @@ std::vector PopulateSeparationState(const Vehicle *v_start) // Do not try to separate vehicles on depot service or halt orders separation_valid = false; } - if (order->IsType(OT_RELEASE_SLOT) || order->IsType(OT_COUNTER)) { - // Do not try to separate vehicles on release slot or change counter orders + if (order->IsType(OT_RELEASE_SLOT) || order->IsType(OT_COUNTER) || order->IsType(OT_DUMMY)) { + // Do not try to separate vehicles on release slot, change counter, or invalid orders separation_valid = false; } int order_ticks;