Mercurial > hg > openttd
changeset 9874:f6aeb086fbba draft
(svn r14021) -Fix (r13957) [YAPP]: Overbuilding station tiles with non-track tiles could produce stale reservations. (michi_cc)
author | smatz <smatz@openttd.org> |
---|---|
date | Fri, 08 Aug 2008 13:29:18 +0000 |
parents | 25003e3bd0ef |
children | 455ec20910c6 |
files | src/station_cmd.cpp src/train_cmd.cpp |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1031,6 +1031,9 @@ 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 @@ } 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);
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1949,6 +1949,7 @@ 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);