summaryrefslogtreecommitdiff
path: root/bridge_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'bridge_map.h')
-rw-r--r--bridge_map.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/bridge_map.h b/bridge_map.h
index f1e12db59..6b2c92cdf 100644
--- a/bridge_map.h
+++ b/bridge_map.h
@@ -47,4 +47,51 @@ static inline void SetRoadUnderBridge(TileIndex t, Owner o)
SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_ROAD);
}
+
+static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt)
+{
+ uint northsouth = (d == DIAGDIR_NE || d == DIAGDIR_NW);
+
+ SetTileType(t, MP_TUNNELBRIDGE);
+ SetTileOwner(t, o);
+ _m[t].m2 = bridgetype << 4;
+ _m[t].m4 = 0;
+ _m[t].m5 = 1 << 7 | 0 << 6 | northsouth << 5 | tt << 1 | DiagDirToAxis(d);
+}
+
+static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d)
+{
+ MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
+ _m[t].m3 = 0;
+}
+
+static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
+{
+ MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL);
+ _m[t].m3 = r;
+}
+
+
+static inline void MakeBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, TransportType tt)
+{
+ SetTileType(t, MP_TUNNELBRIDGE);
+ SetTileOwner(t, OWNER_NONE);
+ _m[t].m2 = bridgetype << 4 | piece;
+ _m[t].m3 = 0;
+ _m[t].m4 = 0;
+ _m[t].m5 = 1 << 7 | 1 << 6 | 0 << 5 | 0 << 3 | tt << 1 | a;
+}
+
+static inline void MakeRoadBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a)
+{
+ MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_ROAD);
+}
+
+static inline void MakeRailBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, RailType r)
+{
+ MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_RAIL);
+ SB(_m[t].m3, 4, 4, r);
+}
+
+
#endif