--- a/src/road_cmd.cpp Sun Dec 16 19:28:07 2007 +0000
+++ b/src/road_cmd.cpp Sun Dec 16 19:30:42 2007 +0000
@@ -133,15 +133,8 @@
case MP_TUNNELBRIDGE:
{
- TileIndex endtile;
- if (IsTunnel(tile)) {
- if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
- endtile = GetOtherTunnelEnd(tile);
- } else {
- if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
- endtile = GetOtherBridgeEnd(tile);
- }
-
+ if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
+ TileIndex endtile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
if (GetVehicleTunnelBridge(tile, endtile) != NULL) return CMD_ERROR;
} break;
@@ -514,15 +507,11 @@
case MP_TUNNELBRIDGE:
{
- TileIndex endtile;
- if (IsTunnel(tile)) {
- if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
- endtile = GetOtherTunnelEnd(tile);
- } else {
- if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
- endtile = GetOtherBridgeEnd(tile);
- }
+ if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+
+ TileIndex endtile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
+
/* Don't allow "upgrading" the bridge/tunnel when vehicles are already driving on it */
if (GetVehicleTunnelBridge(tile, endtile) != NULL) return CMD_ERROR;
} break;