src/vehicle.cpp
branchnoai
changeset 9732 f8eb3e208514
parent 9724 b39bc69bb2f2
child 9800 ab08ca2a2018
--- a/src/vehicle.cpp	Thu Feb 21 22:34:54 2008 +0000
+++ b/src/vehicle.cpp	Fri Feb 22 00:25:54 2008 +0000
@@ -613,8 +613,10 @@
  */
 void VehicleEnteredDepotThisTick(Vehicle *v)
 {
-	/* we need to set v->leave_depot_instantly as we have no control of it's contents at this time */
-	if (HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) {
+	/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
+	 * Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
+	if ((HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) ||
+			(v->vehstatus & VS_STOPPED)) {
 		/* we keep the vehicle in the depot since the user ordered it to stay */
 		v->leave_depot_instantly = false;
 	} else {
@@ -2797,6 +2799,7 @@
 
 	    SLE_VAR(Vehicle, day_counter,          SLE_UINT8),
 	    SLE_VAR(Vehicle, tick_counter,         SLE_UINT8),
+	SLE_CONDVAR(Vehicle, running_ticks,        SLE_UINT8,                   88, SL_MAX_VERSION),
 
 	    SLE_VAR(Vehicle, cur_order_index,      SLE_UINT8),
 	    SLE_VAR(Vehicle, num_orders,           SLE_UINT8),
@@ -2853,11 +2856,11 @@
 	 SLE_CONDVAR(Vehicle, value,                SLE_FILE_I32 | SLE_VAR_I64, 0, 64),
 	 SLE_CONDVAR(Vehicle, value,                SLE_INT64,                 65, SL_MAX_VERSION),
 
-	    SLE_VAR(Vehicle, random_bits,          SLE_UINT8),
-	    SLE_VAR(Vehicle, waiting_triggers,     SLE_UINT8),
-
-	    SLE_REF(Vehicle, next_shared,          REF_VEHICLE),
-	    SLE_REF(Vehicle, prev_shared,          REF_VEHICLE),
+	 SLE_CONDVAR(Vehicle, random_bits,          SLE_UINT8,                 2, SL_MAX_VERSION),
+	 SLE_CONDVAR(Vehicle, waiting_triggers,     SLE_UINT8,                 2, SL_MAX_VERSION),
+
+	 SLE_CONDREF(Vehicle, next_shared,        REF_VEHICLE,                 2, SL_MAX_VERSION),
+	 SLE_CONDREF(Vehicle, prev_shared,        REF_VEHICLE,                 2, SL_MAX_VERSION),
 
 	SLE_CONDVAR(Vehicle, group_id,             SLE_UINT16,                60, SL_MAX_VERSION),