(svn r14285) -Fix [FS#2263]: A train inside a wormhole could free the reservation of another train inside the wormhole.

This commit is contained in:
michi_cc
2008-09-09 19:02:47 +00:00
parent a7a7e2d3cc
commit fa3f2ae035
3 changed files with 18 additions and 13 deletions

View File

@@ -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);
}