summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-08-08 13:29:18 +0000
committersmatz <smatz@openttd.org>2008-08-08 13:29:18 +0000
commit5229e45363cdbb2dbf8ae303475714e48fe4c4a6 (patch)
tree9b08fdf1809217b1d55fa4dc95bc38067a624c24 /src
parentde629dd62fd172bdb64023c53f6c32936f5c3f93 (diff)
downloadopenttd-5229e45363cdbb2dbf8ae303475714e48fe4c4a6.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.cpp9
-rw-r--r--src/train_cmd.cpp1
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);