summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-01-10 15:27:57 +0000
committerfrosch <frosch@openttd.org>2009-01-10 15:27:57 +0000
commit07d1c28025749c97473371d3944a4b5be9fb2751 (patch)
tree2f375370769d24c02a5095cf31d4dce3177a0d5d
parentdb546e607f72c70fb89fe05f5baa7b425bb92123 (diff)
downloadopenttd-07d1c28025749c97473371d3944a4b5be9fb2751.tar.xz
(svn r14957) -Fix [FS#2516]: Do not abort train movement, when we are just about to reach the end of the platform.
-rw-r--r--src/train_cmd.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index dc9d3c993..8fc439dd5 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3670,6 +3670,7 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
} else {
/* Not inside depot */
+ /* Reverse when we are at the end of the track already, do not move to the new position */
if (IsFrontEngine(v) && !TrainCheckIfLineEnds(v)) return;
uint32 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
@@ -3677,11 +3678,9 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
goto invalid_rail;
}
if (HasBit(r, VETS_ENTERED_STATION)) {
+ /* The new position is the end of the platform */
TrainEnterStation(v, r >> VETS_STATION_ID_OFFSET);
- return;
- }
-
- if (v->current_order.IsType(OT_LEAVESTATION)) {
+ } else if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}