(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()

This commit is contained in:
tron
2006-03-17 10:10:31 +00:00
parent d8677f1afa
commit 89090790c2
9 changed files with 68 additions and 51 deletions

View File

@@ -36,7 +36,6 @@ typedef enum RailTypes {
RAILTYPE_MONO = 1,
RAILTYPE_MAGLEV = 2,
RAILTYPE_END,
RAILTYPE_MASK = 0x3,
INVALID_RAILTYPE = 0xFF
} RailType;
@@ -45,6 +44,33 @@ static inline RailType GetRailType(TileIndex t)
return (RailType)GB(_m[t].m3, 0, 4);
}
// TODO remove this by moving to the same bits as GetRailType()
static inline RailType GetRailTypeCrossing(TileIndex t)
{
return (RailType)GB(_m[t].m4, 0, 4);
}
static inline RailType GetRailTypeOnBridge(TileIndex t)
{
return (RailType)GB(_m[t].m3, 4, 4);
}
static inline void SetRailType(TileIndex t, RailType r)
{
SB(_m[t].m3, 0, 4, r);
}
// TODO remove this by moving to the same bits as SetRailType()
static inline void SetRailTypeCrossing(TileIndex t, RailType r)
{
SB(_m[t].m4, 0, 4, r);
}
static inline void SetRailTypeOnBridge(TileIndex t, RailType r)
{
SB(_m[t].m3, 4, 4, r);
}
/** These are used to specify a single track.
* Can be translated to a trackbit with TrackToTrackbit */