1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-30 09:59:10 +00:00

Cleanup: Apply automatic separation to fully timetabled vehicles

This commit is contained in:
James Ross
2023-12-22 16:39:35 +00:00
parent 80e2ba99fe
commit bbddd92ec4

View File

@@ -2444,7 +2444,12 @@ void Vehicle::UpdateAutomaticSeparation()
TimerGameTick::Ticks separation = std::max(1, vehicles > 0 ? round_trip_time * vehicles_moving_ratio / vehicles / vehicles : 1);
/* Finally we can calculate when this vehicle should depart; if that's in the past, it'll depart right now */
this->first_order_last_departure = std::max(last_departure + separation, TimerGameTick::counter);
TimerGameTick::TickCounter next_departure = last_departure + separation;
this->first_order_last_departure = std::max(next_departure, TimerGameTick::counter);
/* Update vehicle lateness based on the automatic separation, overriding the timetable */
this->lateness_counter = TimerGameTick::counter - next_departure;
SetWindowDirty(WC_VEHICLE_TIMETABLE, this->index);
/* Debug logging can be quite spammy as it prints a line every time a vehicle departs the first manual order */
if (_debug_misc_level >= 4) {