diff options
author | peter1138 <peter1138@openttd.org> | 2017-03-28 21:44:40 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2017-03-28 21:44:40 +0000 |
commit | 06785c9df2065183a4890c15fdbb5a325ee8ccbf (patch) | |
tree | 49220de7d23029df5d1e72eecad027a614d26544 | |
parent | 54025df392d83bc3f4b707554ac723d20021409b (diff) | |
download | openttd-06785c9df2065183a4890c15fdbb5a325ee8ccbf.tar.xz |
(svn r27833) -Change: Trackdir maps directly to TrackdirBits
-rw-r--r-- | src/track_type.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/track_type.h b/src/track_type.h index c0bfa0887..2982288bb 100644 --- a/src/track_type.h +++ b/src/track_type.h @@ -104,22 +104,22 @@ typedef TinyEnumT<Trackdir> TrackdirByte; * direction (corresponding to the Track enum) and 8-13 in the other direction. */ enum TrackdirBits { - TRACKDIR_BIT_NONE = 0x0000, ///< No track build - TRACKDIR_BIT_X_NE = 0x0001, ///< Track x-axis, direction north-east - TRACKDIR_BIT_Y_SE = 0x0002, ///< Track y-axis, direction south-east - TRACKDIR_BIT_UPPER_E = 0x0004, ///< Track upper, direction east - TRACKDIR_BIT_LOWER_E = 0x0008, ///< Track lower, direction east - TRACKDIR_BIT_LEFT_S = 0x0010, ///< Track left, direction south - TRACKDIR_BIT_RIGHT_S = 0x0020, ///< Track right, direction south + TRACKDIR_BIT_NONE = 0U, ///< No track build + TRACKDIR_BIT_X_NE = 1U << TRACKDIR_X_NE, ///< Track x-axis, direction north-east + TRACKDIR_BIT_Y_SE = 1U << TRACKDIR_Y_SE, ///< Track y-axis, direction south-east + TRACKDIR_BIT_UPPER_E = 1U << TRACKDIR_UPPER_E, ///< Track upper, direction east + TRACKDIR_BIT_LOWER_E = 1U << TRACKDIR_LOWER_E, ///< Track lower, direction east + TRACKDIR_BIT_LEFT_S = 1U << TRACKDIR_LEFT_S, ///< Track left, direction south + TRACKDIR_BIT_RIGHT_S = 1U << TRACKDIR_RIGHT_S, ///< Track right, direction south /* Again, note the two missing values here. This enables trackdir -> track conversion by doing (trackdir & 0xFF) */ - TRACKDIR_BIT_X_SW = 0x0100, ///< Track x-axis, direction south-west - TRACKDIR_BIT_Y_NW = 0x0200, ///< Track y-axis, direction north-west - TRACKDIR_BIT_UPPER_W = 0x0400, ///< Track upper, direction west - TRACKDIR_BIT_LOWER_W = 0x0800, ///< Track lower, direction west - TRACKDIR_BIT_LEFT_N = 0x1000, ///< Track left, direction north - TRACKDIR_BIT_RIGHT_N = 0x2000, ///< Track right, direction north - TRACKDIR_BIT_MASK = 0x3F3F, ///< Bitmask for bit-operations - INVALID_TRACKDIR_BIT = 0xFFFF, ///< Flag for an invalid trackdirbit value + TRACKDIR_BIT_X_SW = 1U << TRACKDIR_X_SW, ///< Track x-axis, direction south-west + TRACKDIR_BIT_Y_NW = 1U << TRACKDIR_Y_NW, ///< Track y-axis, direction north-west + TRACKDIR_BIT_UPPER_W = 1U << TRACKDIR_UPPER_W, ///< Track upper, direction west + TRACKDIR_BIT_LOWER_W = 1U << TRACKDIR_LOWER_W, ///< Track lower, direction west + TRACKDIR_BIT_LEFT_N = 1U << TRACKDIR_LEFT_N, ///< Track left, direction north + TRACKDIR_BIT_RIGHT_N = 1U << TRACKDIR_RIGHT_N, ///< Track right, direction north + TRACKDIR_BIT_MASK = 0x3F3F, ///< Bitmask for bit-operations + INVALID_TRACKDIR_BIT = 0xFFFF, ///< Flag for an invalid trackdirbit value }; DECLARE_ENUM_AS_BIT_SET(TrackdirBits) typedef SimpleTinyEnumT<TrackdirBits, uint16> TrackdirBitsShort; |