summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-04-27 20:01:25 +0000
committerrubidium <rubidium@openttd.org>2007-04-27 20:01:25 +0000
commit87b07694a5e74946798bf075728fa919237f0a07 (patch)
tree6e262e826a13f9e0ea9bf807781a11eedf96dd89 /src
parentb10de90b6907993f922a6768525478c862128aef (diff)
downloadopenttd-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.cpp14
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;
}