changeset 14081:386403b2ca6d draft

(svn r18628) -Fix [FS#3422]: (un)loading counter being reset while loading a train and changing the (path) signal setup around the station
author rubidium <rubidium@openttd.org>
date Fri, 25 Dec 2009 18:01:27 +0000
parents 3777c5a4b5eb
children a92e3c331cc1
files src/train_cmd.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2913,7 +2913,12 @@
 	}
 
 	if (HasBit(v->flags, VRF_TRAIN_STUCK)) {
-		v->time_counter = 0;
+		/* This might be called when a train is loading. At that time the counter
+		 * is (mis)used (or rather PBS misuses it) for determining how long to wait
+		 * till going to the next load cycle. If that number is set to 0 the wait
+		 * for loading will be 65535 ticks, which is not what we want. Actually, We
+		 * do not want to reset the waiting period during loading in any case. */
+		if (!v->current_order.IsType(OT_LOADING)) v->time_counter = 0;
 		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 	ClrBit(v->flags, VRF_TRAIN_STUCK);