comparison src/station_cmd.cpp @ 6306:0e06c28cf44e draft

(svn r9178) -Fix (r7573) [FS#679]: Don't allow building docks or buoys under bridges.
author maedhros <maedhros@openttd.org>
date Wed, 14 Mar 2007 12:56:09 +0000
parents dafe7e537d11
children 34db8eef99ef
comparison
equal deleted inserted replaced
6305:13842c0ef6a9 6306:0e06c28cf44e
1627 int32 CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 1627 int32 CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
1628 { 1628 {
1629 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); 1629 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
1630 1630
1631 if (!IsClearWaterTile(tile) || tile == 0) return_cmd_error(STR_304B_SITE_UNSUITABLE); 1631 if (!IsClearWaterTile(tile) || tile == 0) return_cmd_error(STR_304B_SITE_UNSUITABLE);
1632 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
1632 1633
1633 /* allocate and initialize new station */ 1634 /* allocate and initialize new station */
1634 Station *st = new Station(tile); 1635 Station *st = new Station(tile);
1635 if (st == NULL) return CMD_ERROR; 1636 if (st == NULL) return CMD_ERROR;
1636 1637
1746 default: return_cmd_error(STR_304B_SITE_UNSUITABLE); 1747 default: return_cmd_error(STR_304B_SITE_UNSUITABLE);
1747 } 1748 }
1748 1749
1749 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR; 1750 if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile)) return CMD_ERROR;
1750 1751
1752 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
1753
1751 cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); 1754 cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
1752 if (CmdFailed(cost)) return CMD_ERROR; 1755 if (CmdFailed(cost)) return CMD_ERROR;
1753 1756
1754 TileIndex tile_cur = tile + TileOffsByDiagDir(direction); 1757 TileIndex tile_cur = tile + TileOffsByDiagDir(direction);
1755 1758
1756 if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur, NULL) != SLOPE_FLAT) { 1759 if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur, NULL) != SLOPE_FLAT) {
1757 return_cmd_error(STR_304B_SITE_UNSUITABLE); 1760 return_cmd_error(STR_304B_SITE_UNSUITABLE);
1758 } 1761 }
1762
1763 if (MayHaveBridgeAbove(tile_cur) && IsBridgeAbove(tile_cur)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
1759 1764
1760 cost = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); 1765 cost = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
1761 if (CmdFailed(cost)) return CMD_ERROR; 1766 if (CmdFailed(cost)) return CMD_ERROR;
1762 1767
1763 tile_cur += TileOffsByDiagDir(direction); 1768 tile_cur += TileOffsByDiagDir(direction);