From 5229e45363cdbb2dbf8ae303475714e48fe4c4a6 Mon Sep 17 00:00:00 2001 From: smatz Date: Fri, 8 Aug 2008 13:29:18 +0000 Subject: (svn r14021) -Fix (r13957) [YAPP]: Overbuilding station tiles with non-track tiles could produce stale reservations. (michi_cc) --- src/station_cmd.cpp | 9 ++++++++- src/train_cmd.cpp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index baa3392c3..68eec417f 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1031,6 +1031,9 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, if (v != NULL) { FreeTrainTrackReservation(v); *affected_vehicles.Append() = v; + if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(GetVehicleTrackdir(v)), false); + for (; v->Next() != NULL; v = v->Next()) ; + if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(GetVehicleTrackdir(v))), false); } } @@ -1059,7 +1062,11 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, } while (--numtracks); for (uint i = 0; i < affected_vehicles.Length(); ++i) { - TryPathReserve(affected_vehicles[i], true); + Vehicle *v = affected_vehicles[i]; + if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(GetVehicleTrackdir(v)), true); + TryPathReserve(v, true); + for (; v->Next() != NULL; v = v->Next()) ; + if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(GetVehicleTrackdir(v))), true); } st->MarkTilesDirty(false); diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 95c9b613c..37334c0eb 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1949,6 +1949,7 @@ static void ReverseTrainDirection(Vehicle *v) HasSignalOnTrackdir(v->tile, GetVehicleTrackdir(v)) && !IsPbsSignal(GetSignalType(v->tile, FindFirstTrack(v->u.rail.track)))); + if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(GetVehicleTrackdir(v)), true); if (TryPathReserve(v, true, first_tile_okay)) { /* Do a look-ahead now in case our current tile was already a safe tile. */ CheckNextTrainTile(v); -- cgit v1.2.3-70-g09d2