From 93162106a51920853cb06d25ead71185f4823622 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Fri, 22 Aug 2008 19:20:25 +0200 Subject: -Fix (r13952) [FS#2250]: The reservation of adjacent stations was sometimes not freed correctly. --- src/train_cmd.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 950cdd5..dc22232 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2459,6 +2459,7 @@ void FreeTrainTrackReservation(const Vehicle *v, TileIndex origin, Trackdir orig TileIndex tile = origin != INVALID_TILE ? origin : v->tile; Trackdir td = orig_td != INVALID_TRACKDIR ? orig_td : GetVehicleTrackdir(v); bool free_tile = tile != v->tile || !(IsRailwayStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE)); + StationID station_id = IsRailwayStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION; /* Don't free reservation if it's not ours. */ if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return; @@ -2493,7 +2494,7 @@ void FreeTrainTrackReservation(const Vehicle *v, TileIndex origin, Trackdir orig } /* Don't free first station/bridge/tunnel if we are on it. */ - if (free_tile || (!ft.m_is_station && !ft.m_is_tunnel && !ft.m_is_bridge)) ClearPathReservation(tile, td); + if (free_tile || (!(ft.m_is_station && GetStationIndex(ft.m_new_tile) == station_id) && !ft.m_is_tunnel && !ft.m_is_bridge)) ClearPathReservation(tile, td); free_tile = true; } -- 1.5.6.4