Add signal style flag for unconditional reserve through

Add map bits for unconditional reserve through
Adjust signal aspect/state handling
This commit is contained in:
Jonathan G Rennison
2022-06-19 04:15:27 +01:00
parent 7ae06124ae
commit bdd73a19a1
18 changed files with 144 additions and 15 deletions

View File

@@ -397,6 +397,11 @@ static inline void SetSignalAspect(TileIndex t, Track track, uint8 aspect)
SB(_me[t].m7, pos, 3, aspect);
}
static inline bool NonZeroSignalStylePossiblyOnTile(TileIndex t)
{
return _me[t].m6 != 0;
}
static inline uint8 GetSignalStyle(TileIndex t, Track track)
{
assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
@@ -411,6 +416,20 @@ static inline void SetSignalStyle(TileIndex t, Track track, uint8 style)
SB(_me[t].m6, pos, 4, style);
}
static inline bool GetSignalAlwaysReserveThrough(TileIndex t, Track track)
{
assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
return HasBit(_me[t].m7, pos);
}
static inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool reserve_through)
{
assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
SB(_me[t].m7, pos, 1, reserve_through ? 1 : 0);
}
/**
* Set the states of the signals (Along/AgainstTrackDir)
* @param tile the tile to set the states for