Mercurial > hg > openttd
changeset 19197:6880d0499ff8 draft
(svn r24071) -Fix [FS#5093]: Reversing trains while they were entering or leaving a depot could lead to stuck trains.
author | michi_cc <michi_cc@openttd.org> |
---|---|
date | Sun, 25 Mar 2012 23:42:49 +0000 |
parents | 914938be9309 |
children | edd5992668f9 |
files | src/pbs.cpp src/train_cmd.cpp |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -369,7 +369,8 @@ */ bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg) { - if (IsRailDepotTile(tile)) return true; + /* A depot is safe if we enter it, but not when we exit. */ + if (IsRailDepotTile(tile) && TrackdirToExitdir(trackdir) != GetRailDepotDirection(tile)) return true; if (IsTileType(tile, MP_RAILWAY)) { /* For non-pbs signals, stop on the signal tile. */
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2200,6 +2200,8 @@ bool free_tile = tile != v->tile || !(IsRailStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE)); StationID station_id = IsRailStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION; + /* A train inside a depot can't have a reservation. */ + if (v->track == TRACK_BIT_DEPOT) return; /* Don't free reservation if it's not ours. */ if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return;