(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them

This commit is contained in:
tron
2006-03-01 12:31:39 +00:00
parent 793613a286
commit 3fc68907e3
3 changed files with 17 additions and 20 deletions

11
road.h
View File

@@ -17,6 +17,11 @@ typedef enum RoadBits {
ROAD_ALL = ROAD_X | ROAD_Y
} RoadBits;
static inline RoadBits ComplementRoadBits(RoadBits r)
{
return ROAD_ALL ^ r;
}
static inline RoadBits GetRoadBits(TileIndex tile)
{
return GB(_m[tile].m5, 0, 4);
@@ -27,6 +32,12 @@ static inline RoadBits GetCrossingRoadBits(TileIndex tile)
return _m[tile].m5 & 8 ? ROAD_Y : ROAD_X;
}
static inline TrackBits GetCrossingRailBits(TileIndex tile)
{
return _m[tile].m5 & 8 ? TRACK_BIT_X : TRACK_BIT_Y;
}
typedef enum RoadType {
ROAD_NORMAL,
ROAD_CROSSING,