changeset 17094:4154ccfd4d39 draft

(svn r21831) -Fix [FS#4414]: service orders for trains/aircraft would (sometimes) not get a time when autofilling
author rubidium <rubidium@openttd.org>
date Tue, 18 Jan 2011 14:25:45 +0000
parents 181ae8787af7
children f9112c03b14d
files src/timetable_cmd.cpp
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -279,8 +279,14 @@
 		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);
 		}