summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-16 10:00:50 +0000
committertron <tron@openttd.org>2006-03-16 10:00:50 +0000
commit483c8f701829006673a5477a8d1073f29a92f6f9 (patch)
tree5a5d3df69aa5b59939332cea85c0446e0cd60bf6
parenta3c45635a77473016a1145e4a586b7a2a5527cda (diff)
downloadopenttd-483c8f701829006673a5477a8d1073f29a92f6f9.tar.xz
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
-rw-r--r--bridge_map.h21
-rw-r--r--tunnelbridge_cmd.c21
2 files changed, 22 insertions, 20 deletions
diff --git a/bridge_map.h b/bridge_map.h
index 610728060..bbb443615 100644
--- a/bridge_map.h
+++ b/bridge_map.h
@@ -21,6 +21,27 @@ static inline bool IsBridgeMiddle(TileIndex t)
}
+/**
+ * Determines which piece of a bridge is contained in the current tile
+ * @param tile The tile to analyze
+ * @return the piece
+ */
+static inline uint GetBridgePiece(TileIndex tile)
+{
+ return GB(_m[tile].m2, 0, 4);
+}
+
+
+/**
+ * Determines the type of bridge on a tile
+ * @param tile The tile to analyze
+ * @return The bridge type
+ */
+static inline uint GetBridgeType(TileIndex tile)
+{
+ return GB(_m[tile].m2, 4, 4);
+}
+
/**
* Get the direction pointing onto the bridge
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 7fec7bbfa..e89f2795e 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -97,25 +97,6 @@ static inline const PalSpriteID *GetBridgeSpriteTable(int index, byte table)
}
}
-/**
- * Determines which piece of a bridge is contained in the current tile
- * @param tile The tile to analyze
- * @return the piece
- */
-static inline int GetBridgePiece(TileIndex tile)
-{
- return GB(_m[tile].m2, 0, 4);
-}
-
-/**
- * Determines the type of bridge on a tile
- * @param tile The tile to analyze
- * @return The bridge type
- */
-static inline int GetBridgeType(TileIndex tile)
-{
- return GB(_m[tile].m2, 4, 4);
-}
/** check if bridge can be built on slope
* direction 0 = X-axis, direction 1 = Y-axis
@@ -1215,7 +1196,7 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
td->str = (GetTunnelTransportType(tile) == TRANSPORT_RAIL) ?
STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL;
} else {
- td->str = _bridge_tile_str[GB(_m[tile].m5, 1, 2) << 4 | GB(_m[tile].m2, 4, 4)];
+ td->str = _bridge_tile_str[GB(_m[tile].m5, 1, 2) << 4 | GetBridgeType(tile)];
// the owner is stored at the end of the bridge
if (IsBridgeMiddle(tile)) tile = GetSouthernBridgeEnd(tile);