10 #include "../../map_func.h" |
10 #include "../../map_func.h" |
11 #include "../../variables.h" |
11 #include "../../variables.h" |
12 #include "../../station_func.h" |
12 #include "../../station_func.h" |
13 #include "../../command_type.h" |
13 #include "../../command_type.h" |
14 #include "../../settings_type.h" |
14 #include "../../settings_type.h" |
|
15 #include "../../player_func.h" |
15 #include "../../road_map.h" |
16 #include "../../road_map.h" |
16 |
17 |
17 /* static */ bool AITile::IsBuildable(TileIndex tile) |
18 /* static */ bool AITile::IsBuildable(TileIndex tile) |
18 { |
19 { |
19 if (!::IsValidTile(tile)) return false; |
20 if (!::IsValidTile(tile)) return false; |
20 |
21 |
21 switch (::GetTileType(tile)) { |
22 switch (::GetTileType(tile)) { |
22 default: return true; |
23 default: return false; |
23 case MP_VOID: |
24 case MP_CLEAR: return true; |
24 case MP_HOUSE: |
|
25 case MP_STATION: |
|
26 case MP_INDUSTRY: |
|
27 case MP_UNMOVABLE: |
|
28 case MP_WATER: return false; |
|
29 |
|
30 case MP_ROAD: |
25 case MP_ROAD: |
31 /* Depots aren't considered buildable */ |
26 /* Depots aren't considered buildable */ |
32 if (::GetRoadTileType(tile) == ROAD_TILE_DEPOT) return false; |
27 if (::GetRoadTileType(tile) == ROAD_TILE_DEPOT) return false; |
33 return true; |
28 if (CountBits(GetAllRoadBits(tile)) != 1) return false; |
|
29 if (IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN)) return true; |
|
30 if (IsRoadOwner(tile, ROADTYPE_ROAD, _current_player)) return true; |
|
31 return false; |
34 } |
32 } |
35 } |
33 } |
36 |
34 |
37 /* static */ bool AITile::IsBuildableRectangle(TileIndex tile, uint width, uint height) |
35 /* static */ bool AITile::IsBuildableRectangle(TileIndex tile, uint width, uint height) |
38 { |
36 { |