diff options
author | michi_cc <michi_cc@openttd.org> | 2008-09-09 19:02:47 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2008-09-09 19:02:47 +0000 |
commit | fa3f2ae035a2ad1bcb83b6bbc1e05b21911b5844 (patch) | |
tree | 86a1f340910cf221edb5fec9ee8316084e51a823 /src/vehicle.cpp | |
parent | a7a7e2d3cc1c2220765510140810c442a27a4a4b (diff) | |
download | openttd-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.cpp | 8 |
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); } |