From ab2ce64b6b547f6e7e184593697227daceec82f2 Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 18 Jul 2012 19:25:00 +0000 Subject: (svn r24414) -Fix [FS#5221]: Disallow removing roadtypes from bridges when not dragging in bridge direction. --- src/road_cmd.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/road_cmd.cpp') diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 0930d2ace..6f91e20be 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -216,6 +216,9 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec CommandCost cost(EXPENSES_CONSTRUCTION); if (IsTileType(tile, MP_TUNNELBRIDGE)) { + /* Removing any roadbit in the bridge axis removes the roadtype (that's the behaviour remove-long-roads needs) */ + if ((AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) & pieces) == ROAD_NONE) return_cmd_error(rt == ROADTYPE_TRAM ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD); + TileIndex other_end = GetOtherTunnelBridgeEnd(tile); /* Pay for *every* tile of the bridge or tunnel */ uint len = GetTunnelBridgeLength(other_end, tile) + 2; @@ -651,6 +654,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 case MP_TUNNELBRIDGE: { if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) goto do_clear; + /* Only allow building the outern roadbit, so building long roads stops at existing bridges */ if (MirrorRoadBits(DiagDirToRoadBits(GetTunnelBridgeDirection(tile))) != pieces) goto do_clear; if (HasTileRoadType(tile, rt)) return_cmd_error(STR_ERROR_ALREADY_BUILT); /* Don't allow adding roadtype to the bridge/tunnel when vehicles are already driving on it */ -- cgit v1.2.3-54-g00ecf