diff options
author | tron <tron@openttd.org> | 2006-03-17 10:10:31 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-17 10:10:31 +0000 |
commit | 89090790c2405a738f5977310549cf94df9c06cb (patch) | |
tree | 0fa3ce74d133cc13b1aaf01d162e59d16ce3371e /rail_map.h | |
parent | d8677f1afad4e706b92689b471d6c7a6c210aa82 (diff) | |
download | openttd-89090790c2405a738f5977310549cf94df9c06cb.tar.xz |
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
Diffstat (limited to 'rail_map.h')
-rw-r--r-- | rail_map.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/rail_map.h b/rail_map.h index b6f9512fe..e03893470 100644 --- a/rail_map.h +++ b/rail_map.h @@ -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 */ |