From 39d7f3b2bd486d5332ad3a6ddfe518dd86b65fa4 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 18 Jan 2011 14:25:45 +0000 Subject: (svn r21831) -Fix [FS#4414]: service orders for trains/aircraft would (sometimes) not get a time when autofilling --- src/timetable_cmd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/timetable_cmd.cpp') diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index dc6125777..c633ec61b 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -279,8 +279,14 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) if (!v->current_order.IsType(OT_CONDITIONAL) && (travelling || time_taken > v->current_order.wait_time)) { /* Round the time taken up to the nearest day, as this will avoid * confusion for people who are timetabling in days, and can be - * adjusted later by people who aren't. */ - time_taken = CeilDiv(time_taken, DAY_TICKS) * DAY_TICKS; + * adjusted later by people who aren't. + * For trains/aircraft multiple movement cycles are done in one + * tick. This makes it possible to leave the station and process + * e.g. a depot order in the same tick, causing it to not fill + * the timetable entry like is done for road vehicles/ships. + * Thus always make sure at least one tick is used between the + * processing of different orders when filling the timetable. */ + time_taken = CeilDiv(max(time_taken, 1U), DAY_TICKS) * DAY_TICKS; ChangeTimetable(v, v->cur_order_index, time_taken, travelling); } -- cgit v1.2.3-54-g00ecf