diff options
author | rubidium <rubidium@openttd.org> | 2007-04-27 20:01:25 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-04-27 20:01:25 +0000 |
commit | 87b07694a5e74946798bf075728fa919237f0a07 (patch) | |
tree | 6e262e826a13f9e0ea9bf807781a11eedf96dd89 /src | |
parent | b10de90b6907993f922a6768525478c862128aef (diff) | |
download | openttd-87b07694a5e74946798bf075728fa919237f0a07.tar.xz |
(svn r9726) -Fix [FS#738]: crash when destroying bridge with train partially one it.
Diffstat (limited to 'src')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index f6131f5a1..771cb3f52 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -639,10 +639,11 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) if (!CheckAllowRemoveTunnelBridge(tile)) return CMD_ERROR; endtile = GetOtherBridgeEnd(tile); + byte bridge_height = GetBridgeHeight(tile); - if (!EnsureNoVehicleOnGround(tile) || - !EnsureNoVehicleOnGround(endtile) || - IsVehicleOnBridge(tile, endtile, GetBridgeHeight(tile))) { + if (FindVehicleOnTileZ(tile, bridge_height) != NULL || + FindVehicleOnTileZ(endtile, bridge_height) != NULL || + IsVehicleOnBridge(tile, endtile, bridge_height)) { return CMD_ERROR; } @@ -743,10 +744,11 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec) if (!CheckTileOwnership(tile)) return CMD_ERROR; endtile = GetOtherBridgeEnd(tile); + byte bridge_height = GetBridgeHeight(tile); - if (!EnsureNoVehicleOnGround(tile) || - !EnsureNoVehicleOnGround(endtile) || - IsVehicleOnBridge(tile, endtile, GetBridgeHeight(tile))) { + if (FindVehicleOnTileZ(tile, bridge_height) != NULL || + FindVehicleOnTileZ(endtile, bridge_height) != NULL || + IsVehicleOnBridge(tile, endtile, bridge_height)) { return CMD_ERROR; } |