summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-22 22:42:21 +0000
committerfrosch <frosch@openttd.org>2008-08-22 22:42:21 +0000
commit2dd9bc672a2205c6c25b0d1472421fdb5976f125 (patch)
treec9ecef80734fbff5f65e4a5f515493be0cd4fef1 /src
parent7020a48ea024caf53c1d715ef88e16bf50940e24 (diff)
downloadopenttd-2dd9bc672a2205c6c25b0d1472421fdb5976f125.tar.xz
(svn r14131) -Fix (r13952) [FS#2250]: The reservation of adjacent stations was sometimes not freed correctly. (michi_cc)
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 0dfa2189e..344d35981 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2464,6 +2464,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;
@@ -2498,7 +2499,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;
}