forked from mirror/OpenTTD
Codechange: Use HasTrack(dir) to improve code readability.
This commit is contained in:
@@ -331,6 +331,28 @@ static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
|
||||
return (TrackdirBits)(bits * 0x101);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a TrackBits has a given Track.
|
||||
* @param tracks The track bits.
|
||||
* @param track The track to check.
|
||||
*/
|
||||
static inline bool HasTrack(TrackBits tracks, Track track)
|
||||
{
|
||||
assert(IsValidTrack(track));
|
||||
return HasBit(tracks, track);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a TrackdirBits has a given Trackdir.
|
||||
* @param trackdirs The trackdir bits.
|
||||
* @param trackdir The trackdir to check.
|
||||
*/
|
||||
static inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir)
|
||||
{
|
||||
assert(IsValidTrackdir(trackdir));
|
||||
return HasBit(trackdirs, trackdir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the present-trackdir-information of a TrackStatus.
|
||||
*
|
||||
|
Reference in New Issue
Block a user