equal
deleted
inserted
replaced
24 #include "gui.h" |
24 #include "gui.h" |
25 #include "unmovable_map.h" |
25 #include "unmovable_map.h" |
26 #include "water_map.h" |
26 #include "water_map.h" |
27 #include "variables.h" |
27 #include "variables.h" |
28 #include "bridge.h" |
28 #include "bridge.h" |
29 #include "bridge_map.h" |
|
30 #include "table/town_land.h" |
29 #include "table/town_land.h" |
31 |
30 |
32 enum { |
31 enum { |
33 /* Max towns: 64000 (8 * 8000) */ |
32 /* Max towns: 64000 (8 * 8000) */ |
34 TOWN_POOL_BLOCK_SIZE_BITS = 3, /* In bits, so (1 << 3) == 8 */ |
33 TOWN_POOL_BLOCK_SIZE_BITS = 3, /* In bits, so (1 << 3) == 8 */ |
1092 }; |
1091 }; |
1093 |
1092 |
1094 slope = GetTileSlope(tile, NULL); |
1093 slope = GetTileSlope(tile, NULL); |
1095 if (IsSteepSlope(slope)) return false; |
1094 if (IsSteepSlope(slope)) return false; |
1096 |
1095 |
1097 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; |
|
1098 |
|
1099 b = 0; |
1096 b = 0; |
1100 if ((slope != SLOPE_FLAT && ~slope & _masks[mode])) b = ~b; |
1097 if ((slope != SLOPE_FLAT && ~slope & _masks[mode])) b = ~b; |
1101 if ((tileh != SLOPE_FLAT && ~tileh & _masks[mode+4])) b = ~b; |
1098 if ((tileh != SLOPE_FLAT && ~tileh & _masks[mode+4])) b = ~b; |
1102 if (b) |
1099 if (b) |
1103 return false; |
1100 return false; |
1136 |
1133 |
1137 for (i = 0; i != 4; i++) { |
1134 for (i = 0; i != 4; i++) { |
1138 tile += ToTileIndexDiff(_tile_add[i]); |
1135 tile += ToTileIndexDiff(_tile_add[i]); |
1139 |
1136 |
1140 if (GetTileSlope(tile, NULL) != SLOPE_FLAT) return false; |
1137 if (GetTileSlope(tile, NULL) != SLOPE_FLAT) return false; |
1141 |
|
1142 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; |
|
1143 |
1138 |
1144 if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_FORCETEST, CMD_LANDSCAPE_CLEAR))) |
1139 if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_FORCETEST, CMD_LANDSCAPE_CLEAR))) |
1145 return false; |
1140 return false; |
1146 } |
1141 } |
1147 |
1142 |
1273 int32 r; |
1268 int32 r; |
1274 |
1269 |
1275 // make sure it's possible |
1270 // make sure it's possible |
1276 if (!EnsureNoVehicle(tile)) return false; |
1271 if (!EnsureNoVehicle(tile)) return false; |
1277 if (IsSteepSlope(GetTileSlope(tile, NULL))) return false; |
1272 if (IsSteepSlope(GetTileSlope(tile, NULL))) return false; |
1278 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; |
|
1279 |
1273 |
1280 r = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); |
1274 r = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); |
1281 if (CmdFailed(r)) return false; |
1275 if (CmdFailed(r)) return false; |
1282 |
1276 |
1283 DoBuildTownHouse(t, tile); |
1277 DoBuildTownHouse(t, tile); |