summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-16 20:08:49 +0000
committerrubidium <rubidium@openttd.org>2009-05-16 20:08:49 +0000
commit8324cfc875ce26eb7d8cfed42290bf8e20e7c3fc (patch)
treed2e2275666914c51e49a4b1befc3270ecf6a8933 /src
parentbdbbe3a09b05af55e25008890e7485a7b34aeaa4 (diff)
downloadopenttd-8324cfc875ce26eb7d8cfed42290bf8e20e7c3fc.tar.xz
(svn r16322) -Fix [FS#2873]: trains could get stuck in a depot when they wanted to go to the same depot again.
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 05627c090..4b0a01b9f 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2431,6 +2431,15 @@ static bool CheckTrainStayInDepot(Vehicle *v)
seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
}
+ /* We are leaving a depot, but have to go to the exact same one; re-enter */
+ if (v->tile == v->dest_tile) {
+ /* We need to have a reservation for this to work. */
+ if (GetDepotWaypointReservation(v->tile)) return true;
+ SetDepotWaypointReservation(v->tile, true);
+ VehicleEnterDepot(v);
+ return true;
+ }
+
/* Only leave when we can reserve a path to our destination. */
if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->u.rail.force_proceed == 0) {
/* No path and no force proceed. */