mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r24071) -Fix [FS#5093]: Reversing trains while they were entering or leaving a depot could lead to stuck trains.
This commit is contained in:
parent
1adb9a5c85
commit
f8b62a3c7a
@ -369,7 +369,8 @@ Train *GetTrainForReservation(TileIndex tile, Track track)
|
|||||||
*/
|
*/
|
||||||
bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg)
|
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)) {
|
if (IsTileType(tile, MP_RAILWAY)) {
|
||||||
/* For non-pbs signals, stop on the signal tile. */
|
/* For non-pbs signals, stop on the signal tile. */
|
||||||
|
@ -2200,6 +2200,8 @@ void FreeTrainTrackReservation(const Train *v, TileIndex origin, Trackdir orig_t
|
|||||||
bool free_tile = tile != v->tile || !(IsRailStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE));
|
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;
|
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. */
|
/* Don't free reservation if it's not ours. */
|
||||||
if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return;
|
if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user