Changeset - r22622:c99620fb27ff
[Not reviewed]
master
0 1 0
peter1138 - 8 years ago 2017-03-28 21:44:40
peter1138@openttd.org
(svn r27833) -Change: Trackdir maps directly to TrackdirBits
1 file changed with 15 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/track_type.h
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)