equal
deleted
inserted
replaced
256 if (!CheckBridge_Stuff(bridge_type, bridge_len)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE); |
256 if (!CheckBridge_Stuff(bridge_type, bridge_len)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE); |
257 |
257 |
258 /* retrieve landscape height and ensure it's on land */ |
258 /* retrieve landscape height and ensure it's on land */ |
259 tile_start = TileXY(x, y); |
259 tile_start = TileXY(x, y); |
260 tile_end = TileXY(sx, sy); |
260 tile_end = TileXY(sx, sy); |
261 if (IsWaterTile(tile_start) || IsWaterTile(tile_end)) { |
261 if (IsWaterTile(tile_start) || IsRiverTile(tile_start) || IsWaterTile(tile_end) || IsRiverTile(tile_end)) { |
262 return_cmd_error(STR_02A0_ENDS_OF_BRIDGE_MUST_BOTH); |
262 return_cmd_error(STR_02A0_ENDS_OF_BRIDGE_MUST_BOTH); |
263 } |
263 } |
264 |
264 |
265 tileh_start = GetTileSlope(tile_start, &z_start); |
265 tileh_start = GetTileSlope(tile_start, &z_start); |
266 tileh_end = GetTileSlope(tile_end, &z_end); |
266 tileh_end = GetTileSlope(tile_end, &z_end); |
482 case SLOPE_NW: direction = DIAGDIR_NW; break; |
482 case SLOPE_NW: direction = DIAGDIR_NW; break; |
483 case SLOPE_NE: direction = DIAGDIR_NE; break; |
483 case SLOPE_NE: direction = DIAGDIR_NE; break; |
484 default: return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); |
484 default: return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); |
485 } |
485 } |
486 |
486 |
|
487 if (IsRiverTile(start_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
|
488 |
487 ret = DoCommand(start_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
489 ret = DoCommand(start_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
488 if (CmdFailed(ret)) return ret; |
490 if (CmdFailed(ret)) return ret; |
489 |
491 |
490 /* XXX - do NOT change 'ret' in the loop, as it is used as the price |
492 /* XXX - do NOT change 'ret' in the loop, as it is used as the price |
491 * for the clearing of the entrance of the tunnel. Assigning it to |
493 * for the clearing of the entrance of the tunnel. Assigning it to |
533 cost.AddCost(_price.build_tunnel); |
535 cost.AddCost(_price.build_tunnel); |
534 cost.AddCost(ret); |
536 cost.AddCost(ret); |
535 |
537 |
536 /* if the command fails from here on we want the end tile to be highlighted */ |
538 /* if the command fails from here on we want the end tile to be highlighted */ |
537 _build_tunnel_endtile = end_tile; |
539 _build_tunnel_endtile = end_tile; |
|
540 |
|
541 if (IsRiverTile(end_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
538 |
542 |
539 /* slope of end tile must be complementary to the slope of the start tile */ |
543 /* slope of end tile must be complementary to the slope of the start tile */ |
540 if (end_tileh != ComplementSlope(start_tileh)) { |
544 if (end_tileh != ComplementSlope(start_tileh)) { |
541 /* Check if there is a structure on the terraformed tile. Do not add the cost, that will be done by the terraforming */ |
545 /* Check if there is a structure on the terraformed tile. Do not add the cost, that will be done by the terraforming */ |
542 ret = DoCommand(end_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR); |
546 ret = DoCommand(end_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR); |