summaryrefslogtreecommitdiff
path: root/depot.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-04 16:04:15 +0000
committertron <tron@openttd.org>2006-06-04 16:04:15 +0000
commitfa740023567157cf18d4dd06880307e7b08b7c77 (patch)
tree7fafd1f3b5f9dd18acaf05ec2212fd5099f44243 /depot.h
parent479317b1eb85ba94491e2fd6d330f38fb25e02ea (diff)
downloadopenttd-fa740023567157cf18d4dd06880307e7b08b7c77.tar.xz
(svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
Diffstat (limited to 'depot.h')
-rw-r--r--depot.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/depot.h b/depot.h
index 5acb0fcb5..cf8b00bc7 100644
--- a/depot.h
+++ b/depot.h
@@ -12,6 +12,7 @@
#include "road_map.h"
#include "tile.h"
#include "variables.h"
+#include "water_map.h"
struct Depot {
TileIndex xy;
@@ -98,20 +99,11 @@ static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type
{
assert(IsTileDepotType(tile, type));
- switch (type)
- {
- case TRANSPORT_RAIL: return GetRailDepotDirection(tile);
- case TRANSPORT_ROAD: return GetRoadDepotDirection(tile);
- case TRANSPORT_WATER:
- /* Water is stubborn, it stores the directions in a different order. */
- switch (GB(_m[tile].m5, 0, 2)) {
- case 0: return DIAGDIR_NE;
- case 1: return DIAGDIR_SW;
- case 2: return DIAGDIR_NW;
- case 3: return DIAGDIR_SE;
- }
- default:
- return INVALID_DIAGDIR; /* Not reached */
+ switch (type) {
+ case TRANSPORT_RAIL: return GetRailDepotDirection(tile);
+ case TRANSPORT_ROAD: return GetRoadDepotDirection(tile);
+ case TRANSPORT_WATER: return GetShipDepotDirection(tile);
+ default: return INVALID_DIAGDIR; /* Not reached */
}
}