summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-28 18:15:19 +0000
committeralberth <alberth@openttd.org>2010-02-28 18:15:19 +0000
commit63dd6ce6b0d6508ad3c07263b583b0090b2d4cba (patch)
tree4d49d60b5c90925642ee3309054c5f22836ade02 /src/tunnelbridge_cmd.cpp
parent986d15ef73106270701616373b778e0332e40555 (diff)
downloadopenttd-63dd6ce6b0d6508ad3c07263b583b0090b2d4cba.tar.xz
(svn r19291) -Codechange: Rename HasVehicleOnTunnelBridge() to TunnelBridgeIsFree() and return a CommandCost status.
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);