summaryrefslogtreecommitdiff
path: root/bridge_map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-16 15:16:27 +0000
committertron <tron@openttd.org>2006-03-16 15:16:27 +0000
commit6e988259a42191d8c79c46780981440ed91b5186 (patch)
tree79a0e9518fd43cbe914bddcaebf4983201598bc8 /bridge_map.h
parentb2e804561387d4f8714f53c9e61b0b9e396f60e0 (diff)
downloadopenttd-6e988259a42191d8c79c46780981440ed91b5186.tar.xz
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
Diffstat (limited to 'bridge_map.h')
-rw-r--r--bridge_map.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/bridge_map.h b/bridge_map.h
index bbb443615..f799077b3 100644
--- a/bridge_map.h
+++ b/bridge_map.h
@@ -7,9 +7,21 @@
#include "macros.h"
#include "map.h"
#include "rail.h"
+#include "road_map.h"
#include "tile.h"
+static inline bool IsBridge(TileIndex t)
+{
+ return HASBIT(_m[t].m5, 7);
+}
+
+static inline bool IsBridgeTile(TileIndex t)
+{
+ return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
+}
+
+
static inline bool IsBridgeRamp(TileIndex t)
{
return !HASBIT(_m[t].m5, 6);
@@ -61,6 +73,12 @@ static inline Axis GetBridgeAxis(TileIndex t)
}
+static inline TransportType GetBridgeTransportType(TileIndex t)
+{
+ return (TransportType)GB(_m[t].m5, 1, 2);
+}
+
+
static inline bool IsClearUnderBridge(TileIndex t)
{
return GB(_m[t].m5, 3, 3) == 0;
@@ -82,6 +100,16 @@ static inline TransportType GetTransportTypeUnderBridge(TileIndex t)
return (TransportType)GB(_m[t].m5, 3, 2);
}
+static inline RoadBits GetRoadBitsUnderBridge(TileIndex t)
+{
+ return GetBridgeAxis(t) == AXIS_X ? ROAD_Y : ROAD_X;
+}
+
+static inline TrackBits GetRailBitsUnderBridge(TileIndex t)
+{
+ return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X;
+}
+
/**
* Finds the end of a bridge in the specified direction starting at a middle tile