summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-16 22:29:30 +0000
committersmatz <smatz@openttd.org>2008-02-16 22:29:30 +0000
commit1aa52374615495f787df9c6331734a13f4a42e0c (patch)
treecfadb68dda56b3777a7ad78394d63e7d088fc72e /src
parent68fda40e4f758cfd176a83bd982a0da7e7c4e5be (diff)
downloadopenttd-1aa52374615495f787df9c6331734a13f4a42e0c.tar.xz
(svn r12163) -Fix [FS#1705]: if a train is 'stopping' when entering a depot, do not let it leave again
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 1e3726b1c..170a88ae2 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -613,8 +613,10 @@ static Vehicle* _first_veh_in_depot_list;
*/
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 {