summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r--src/tunnelbridge_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index fdbfc8a67..020b9f810 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -611,7 +611,9 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
endtile = GetOtherTunnelEnd(tile);
- if (HasVehicleOnTunnelBridge(tile, endtile)) return CMD_ERROR;
+ CommandCost ret = TunnelBridgeIsFree(tile, endtile);
+ ret.SetGlobalErrorMessage();
+ if (ret.Failed()) return ret;
_build_tunnel_endtile = endtile;
@@ -676,7 +678,9 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
endtile = GetOtherBridgeEnd(tile);
- if (HasVehicleOnTunnelBridge(tile, endtile)) return CMD_ERROR;
+ CommandCost ret = TunnelBridgeIsFree(tile, endtile);
+ ret.SetGlobalErrorMessage();
+ if (ret.Failed()) return ret;
direction = GetTunnelBridgeDirection(tile);
delta = TileOffsByDiagDir(direction);