Store tunnel/bridge signal spacing on tile, adjust spacing to fit length

This commit is contained in:
Jonathan G Rennison
2021-08-29 02:11:58 +01:00
parent 67c1e0dd11
commit 16f2ef227b
12 changed files with 73 additions and 26 deletions

View File

@@ -530,6 +530,18 @@ static inline void SetTunnelBridgeExitSignalAspect(TileIndex t, uint8 aspect)
SB(_m[t].m3, 3, 3, aspect);
}
static inline uint GetTunnelBridgeSignalSimulationSpacing(TileIndex t)
{
assert_tile(IsRailTunnelBridgeTile(t), t);
return 1 + GB(_me[t].m8, 12, 4);
}
static inline void SetTunnelBridgeSignalSimulationSpacing(TileIndex t, uint spacing)
{
assert_tile(IsRailTunnelBridgeTile(t), t);
SB(_me[t].m8, 12, 4, spacing - 1);
}
static inline Trackdir GetTunnelBridgeExitTrackdir(TileIndex t, DiagDirection tunnel_bridge_dir)
{
return TrackEnterdirToTrackdir((Track)FIND_FIRST_BIT(GetAcrossTunnelBridgeTrackBits(t)), ReverseDiagDir(tunnel_bridge_dir));