bridge_map.h
branchcustombridgeheads
changeset 5590 dc34c43fc3eb
parent 5573 afa6f92a71fd
child 5591 8cd83b10634f
--- a/bridge_map.h	Thu Dec 28 16:11:07 2006 +0000
+++ b/bridge_map.h	Thu Dec 28 17:21:22 2006 +0000
@@ -16,14 +16,21 @@
 
 static inline bool IsBridge(TileIndex t)
 {
+#if 0
 	assert(IsTileType(t, MP_TUNNELBRIDGE));
 	return HASBIT(_m[t].m5, 7);
+#endif
+	return IsTileType(t, MP_STREET_BRIDGE) || IsTileType(t, MP_RAILWAY_BRIDGE);
 }
 
+#define IsBridgeTile(t) IsBridge(t)
+
+#if 0
 static inline bool IsBridgeTile(TileIndex t)
 {
 	return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
 }
+#endif
 
 
 static inline bool MayHaveBridgeAbove(TileIndex t)
@@ -33,7 +40,9 @@
 		IsTileType(t, MP_RAILWAY) ||
 		IsTileType(t, MP_STREET) ||
 		IsTileType(t, MP_WATER) ||
-		IsTileType(t, MP_TUNNELBRIDGE) ||
+		IsTileType(t, MP_TUNNEL) ||
+		IsTileType(t, MP_STREET_BRIDGE) ||
+		IsTileType(t, MP_RAILWAY_BRIDGE) ||
 		IsTileType(t, MP_UNMOVABLE);
 }
 
@@ -77,7 +86,9 @@
 static inline TransportType GetBridgeTransportType(TileIndex t)
 {
 	assert(IsBridgeTile(t));
-	return (TransportType)GB(_m[t].m5, 2, 2);
+	if (IsTileType(t, MP_STREET_BRIDGE)) return TRANSPORT_ROAD;
+
+	return TRANSPORT_RAIL;
 }
 
 
@@ -127,22 +138,23 @@
 
 static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt)
 {
-	SetTileType(t, MP_TUNNELBRIDGE);
 	SetTileOwner(t, o);
 	_m[t].m2 = bridgetype << 4;
 	_m[t].m4 = 0;
-	_m[t].m5 = 1 << 7 | tt << 2 | d;
+	_m[t].m5 = d;
 }
 
 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d)
 {
 	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
+	SetTileType(t, MP_STREET_BRIDGE);
 	_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);
+	SetTileType(t, MP_RAILWAY_BRIDGE);
 	_m[t].m3 = r;
 }