Mercurial > hg > openttd
changeset 11920:06375a564163 draft
(svn r16322) -Fix [FS#2873]: trains could get stuck in a depot when they wanted to go to the same depot again.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 16 May 2009 20:08:49 +0000 |
parents | 5a02b0ed51bc |
children | b53b2a07cc35 |
files | src/train_cmd.cpp |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2431,6 +2431,15 @@ 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. */