equal
deleted
inserted
replaced
87 } |
87 } |
88 |
88 |
89 /** |
89 /** |
90 * Returns the direction the exit of the depot on the given tile is facing. |
90 * Returns the direction the exit of the depot on the given tile is facing. |
91 */ |
91 */ |
92 static inline uint GetDepotDirection(TileIndex tile, TransportType type) |
92 static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type) |
93 { |
93 { |
94 assert(IsTileDepotType(tile, type)); |
94 assert(IsTileDepotType(tile, type)); |
95 |
95 |
96 switch (type) |
96 switch (type) |
97 { |
97 { |
100 /* Rail and road store a diagonal direction in bits 0 and 1 */ |
100 /* Rail and road store a diagonal direction in bits 0 and 1 */ |
101 return _map5[tile] & 3; |
101 return _map5[tile] & 3; |
102 case TRANSPORT_WATER: |
102 case TRANSPORT_WATER: |
103 /* Water is stubborn, it stores the directions in a different order. */ |
103 /* Water is stubborn, it stores the directions in a different order. */ |
104 switch (_map5[tile] & 3) { |
104 switch (_map5[tile] & 3) { |
105 case 0: return 0; |
105 case 0: return DIAGDIR_NE; |
106 case 1: return 2; |
106 case 1: return DIAGDIR_SW; |
107 case 2: return 3; |
107 case 2: return DIAGDIR_NW; |
108 case 3: return 1; |
108 case 3: return DIAGDIR_SE; |
109 } |
109 } |
110 default: |
110 default: |
111 return 0; /* Not reached */ |
111 return INVALID_DIAGDIR; /* Not reached */ |
112 } |
112 } |
113 } |
113 } |
114 |
114 |
115 Depot *GetDepotByTile(uint tile); |
115 Depot *GetDepotByTile(uint tile); |
116 void InitializeDepot(void); |
116 void InitializeDepot(void); |