diff options
author | rubidium <rubidium@openttd.org> | 2010-12-11 18:28:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-12-11 18:28:34 +0000 |
commit | fe841c3d0b13ac849eef50b6ee8a9ecbfd766b80 (patch) | |
tree | ef6edf85d901b9b00843dfd41246e618a116c825 | |
parent | 997551c59979ace11e63451a7b81120610354241 (diff) | |
download | openttd-fe841c3d0b13ac849eef50b6ee8a9ecbfd766b80.tar.xz |
(svn r21468) -Change: make sure the end of a bridge is always a valid tile as well, and for aqueducts show "wrong land slope" when that would be more appropriate than "bridge heads not at same height"
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 4f67d4323..6a4309445 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -211,7 +211,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u /* unpack parameters */ BridgeType bridge_type = GB(p2, 0, 8); - if (p1 >= MapSize()) return CMD_ERROR; + if (!IsValidTile(p1)) return CMD_ERROR; TransportType transport_type = Extract<TransportType, 15, 2>(p2); @@ -270,6 +270,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u CommandCost terraform_cost_north = CheckBridgeSlopeNorth(direction, &tileh_start, &z_start); CommandCost terraform_cost_south = CheckBridgeSlopeSouth(direction, &tileh_end, &z_end); + /* Aqueducts can't be built of flat land. */ + if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); if (z_start != z_end) return_cmd_error(STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT); CommandCost cost(EXPENSES_CONSTRUCTION); @@ -345,8 +347,6 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (terraform_cost_south.Failed() || (terraform_cost_south.GetCost() != 0 && !allow_on_slopes)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); cost.AddCost(terraform_cost_south); - if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); - const TileIndex heads[] = {tile_start, tile_end}; for (int i = 0; i < 2; i++) { if (MayHaveBridgeAbove(heads[i])) { |