Simplify some rail/signalled tunnel/bridge tile checks

This commit is contained in:
Jonathan G Rennison
2021-11-13 17:26:07 +00:00
parent dad007e16a
commit 48977853a4
3 changed files with 30 additions and 14 deletions

View File

@@ -74,9 +74,7 @@ static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
*/
static inline bool IsRailTunnelBridgeTile(TileIndex t)
{
TransportType tt = Extract<TransportType, 2, 2>(_m[t].m5);
return IsTileType(t, MP_TUNNELBRIDGE) && (tt == TRANSPORT_RAIL);
return IsTileType(t, MP_TUNNELBRIDGE) && (Extract<TransportType, 2, 2>(_m[t].m5) == TRANSPORT_RAIL);
}
static inline void SetTunnelBridgeGroundBits(TileIndex t, uint8 bits)
@@ -381,6 +379,17 @@ static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
return HasBit(_m[t].m5, 5);
}
/**
* Is this a tunnel/bridge entrance tile with signal?
* Tunnel bridge signal simulation has allways bit 5 on at entrance.
* @param t the tile that might be a tunnel/bridge.
* @return true if and only if this tile is a tunnel/bridge entrance.
*/
static inline bool IsTunnelBridgeSignalSimulationEntranceTile(TileIndex t)
{
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 5);
}
/**
* Is this a tunnel/bridge entrance tile with signal only?
* @param t the tile that might be a tunnel/bridge.
@@ -405,6 +414,16 @@ static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
return HasBit(_m[t].m5, 6);
}
/**
* Is this a tunnel/bridge exit?
* @param t the tile that might be a tunnel/bridge.
* @return true if and only if this tile is a tunnel/bridge exit.
*/
static inline bool IsTunnelBridgeSignalSimulationExitTile(TileIndex t)
{
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 6);
}
/**
* Is this a tunnel/bridge exit only?
* @param t the tile that might be a tunnel/bridge.