(svn r12163) -Fix [FS#1705]: if a train is 'stopping' when entering a depot, do not let it leave again
authorsmatz
Sat, 16 Feb 2008 22:29:30 +0000
changeset 9078 938677a99073
parent 9077 dbb5f2dc2414
child 9079 cd6e8c7ebcb7
(svn r12163) -Fix [FS#1705]: if a train is 'stopping' when entering a depot, do not let it leave again
src/vehicle.cpp
--- a/src/vehicle.cpp	Sat Feb 16 17:54:29 2008 +0000
+++ b/src/vehicle.cpp	Sat Feb 16 22:29:30 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 {