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 | 6b37ea7b47d19c6d0e6eb7ad264d5234fccdb969 (patch) | |
tree | 6e262e826a13f9e0ea9bf807781a11eedf96dd89 | |
parent | 49cd2374bb6fdb47cb9a92f666ddd6ac1961b841 (diff) | |
download | openttd-6b37ea7b47d19c6d0e6eb7ad264d5234fccdb969.tar.xz |
(svn r9726) -Fix [FS#738]: crash when destroying bridge with train partially one it.
-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; } |