Implement bidirectional mode for signals on bridges/tunnels

This commit is contained in:
Jonathan G Rennison
2018-06-17 04:27:03 +01:00
parent d03139b241
commit 814f9f7e0f
15 changed files with 170 additions and 71 deletions

View File

@@ -183,7 +183,7 @@ static inline bool IsTunnelBridgeWithSignalSimulation(TileIndex t)
static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
return HasBit(_m[t].m5, 5) && !HasBit(_m[t].m5, 6);
return HasBit(_m[t].m5, 5);
}
/**
@@ -193,11 +193,35 @@ static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
* @return true if and only if this tile is a tunnel/bridge exit.
*/
static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
return HasBit(_m[t].m5, 6);
}
/**
* Is this a tunnel/bridge exit only?
* @param t the tile that might be a tunnel/bridge.
* @pre IsTileType(t, MP_TUNNELBRIDGE)
* @return true if and only if this tile is a tunnel/bridge exit only.
*/
static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
return !HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
}
/**
* Is this a tunnel/bridge entrance and exit?
* @param t the tile that might be a tunnel/bridge.
* @pre IsTileType(t, MP_TUNNELBRIDGE)
* @return true if and only if this tile is a tunnel/bridge entrance and exit.
*/
static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
return HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
}
/**
* Get the signal state for a tunnel/bridge entrance with signal simulation
* @param t the tunnel/bridge entrance or exit tile with signal simulation