diff options
author | smatz <smatz@openttd.org> | 2008-08-08 13:29:18 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-08-08 13:29:18 +0000 |
commit | c665a2f2334c271f0ee61a6553a8b755350fbae4 (patch) | |
tree | 9b08fdf1809217b1d55fa4dc95bc38067a624c24 /src | |
parent | 9f239cca37b3815d113afcb57acaf9e94425e941 (diff) | |
download | openttd-c665a2f2334c271f0ee61a6553a8b755350fbae4.tar.xz |
(svn r14021) -Fix (r13957) [YAPP]: Overbuilding station tiles with non-track tiles could produce stale reservations. (michi_cc)
Diffstat (limited to 'src')
-rw-r--r-- | src/station_cmd.cpp | 9 | ||||
-rw-r--r-- | src/train_cmd.cpp | 1 |
2 files changed, 9 insertions, 1 deletions
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); |