equal
deleted
inserted
replaced
10 #include "pool.h" |
10 #include "pool.h" |
11 #include "rail_map.h" |
11 #include "rail_map.h" |
12 #include "road_map.h" |
12 #include "road_map.h" |
13 #include "tile.h" |
13 #include "tile.h" |
14 #include "variables.h" |
14 #include "variables.h" |
|
15 #include "water_map.h" |
15 |
16 |
16 struct Depot { |
17 struct Depot { |
17 TileIndex xy; |
18 TileIndex xy; |
18 TownID town_index; |
19 TownID town_index; |
19 StationID index; |
20 StationID index; |
96 */ |
97 */ |
97 static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type) |
98 static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type) |
98 { |
99 { |
99 assert(IsTileDepotType(tile, type)); |
100 assert(IsTileDepotType(tile, type)); |
100 |
101 |
101 switch (type) |
102 switch (type) { |
102 { |
103 case TRANSPORT_RAIL: return GetRailDepotDirection(tile); |
103 case TRANSPORT_RAIL: return GetRailDepotDirection(tile); |
104 case TRANSPORT_ROAD: return GetRoadDepotDirection(tile); |
104 case TRANSPORT_ROAD: return GetRoadDepotDirection(tile); |
105 case TRANSPORT_WATER: return GetShipDepotDirection(tile); |
105 case TRANSPORT_WATER: |
106 default: return INVALID_DIAGDIR; /* Not reached */ |
106 /* Water is stubborn, it stores the directions in a different order. */ |
|
107 switch (GB(_m[tile].m5, 0, 2)) { |
|
108 case 0: return DIAGDIR_NE; |
|
109 case 1: return DIAGDIR_SW; |
|
110 case 2: return DIAGDIR_NW; |
|
111 case 3: return DIAGDIR_SE; |
|
112 } |
|
113 default: |
|
114 return INVALID_DIAGDIR; /* Not reached */ |
|
115 } |
107 } |
116 } |
108 } |
117 |
109 |
118 /** |
110 /** |
119 Find out if the slope of the tile is suitable to build a depot of given direction |
111 Find out if the slope of the tile is suitable to build a depot of given direction |