summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2008-09-09 19:02:47 +0000
committermichi_cc <michi_cc@openttd.org>2008-09-09 19:02:47 +0000
commitfa3f2ae035a2ad1bcb83b6bbc1e05b21911b5844 (patch)
tree86a1f340910cf221edb5fec9ee8316084e51a823 /src/vehicle.cpp
parenta7a7e2d3cc1c2220765510140810c442a27a4a4b (diff)
downloadopenttd-fa3f2ae035a2ad1bcb83b6bbc1e05b21911b5844.tar.xz
(svn r14285) -Fix [FS#2263]: A train inside a wormhole could free the reservation of another train inside the wormhole.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index a3886c705..ce757c470 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -178,6 +178,7 @@ bool EnsureNoVehicleOnGround(TileIndex tile)
static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
{
if (v->type != VEH_TRAIN && v->type != VEH_ROAD && v->type != VEH_SHIP) return NULL;
+ if (v == (const Vehicle *)data) return NULL;
_error_message = VehicleInTheWayErrMsg(v);
return v;
@@ -187,12 +188,13 @@ static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
* Finds vehicle in tunnel / bridge
* @param tile first end
* @param endtile second end
+ * @param ignore Ignore this vehicle when searching
* @return true if the bridge has a vehicle
*/
-bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile)
+bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
{
- return HasVehicleOnPos(tile, NULL, &GetVehicleTunnelBridgeProc) ||
- HasVehicleOnPos(endtile, NULL, &GetVehicleTunnelBridgeProc);
+ return HasVehicleOnPos(tile, (void *)ignore, &GetVehicleTunnelBridgeProc) ||
+ HasVehicleOnPos(endtile, (void *)ignore, &GetVehicleTunnelBridgeProc);
}