tron@3147: /* $Id$ */ tron@3147: rubidium@8100: /** @file direction_type.h Different types to 'show' directions. */ belugas@6125: rubidium@8100: #ifndef DIRECTION_TYPE_H rubidium@8100: #define DIRECTION_TYPE_H tron@3147: rubidium@8100: #include "core/enum_type.hpp" rubidium@5587: rubidium@7394: /** rubidium@7394: * Defines the 8 directions on the map. rubidium@7394: * rubidium@7394: * This enum defines 8 possible directions which are used for rubidium@7394: * the vehicles in the game. The directions are aligned straight rubidium@7394: * to the viewport, not to the map. So north points to the top of rubidium@7394: * your viewport and not rotated by 45 degrees left or right to get rubidium@7394: * a "north" used in you games. rubidium@7394: */ rubidium@6248: enum Direction { rubidium@7394: DIR_BEGIN = 0, ///< Used to iterate rubidium@7394: DIR_N = 0, ///< North rubidium@7394: DIR_NE = 1, ///< Northeast rubidium@7394: DIR_E = 2, ///< East rubidium@7394: DIR_SE = 3, ///< Southeast rubidium@7394: DIR_S = 4, ///< South rubidium@7394: DIR_SW = 5, ///< Southwest rubidium@7394: DIR_W = 6, ///< West rubidium@7394: DIR_NW = 7, ///< Northwest rubidium@7394: DIR_END, ///< Used to iterate rubidium@7394: INVALID_DIR = 0xFF, ///< Flag for an invalid direction rubidium@6248: }; tron@3147: smatz@8279: /** Allow incrementing of Direction variables */ smatz@8279: DECLARE_POSTFIX_INCREMENT(Direction); smatz@8279: rubidium@5587: /** Define basic enum properties */ rubidium@5587: template <> struct EnumPropsT : MakeEnumPropsT {}; belugas@6432: typedef TinyEnumT DirectionByte; //typedefing-enumification of Direction rubidium@5587: tron@3147: rubidium@7394: /** rubidium@7394: * Enumeration for the difference between two directions. rubidium@7394: * rubidium@7394: * This enumeration is used to mark differences between rubidium@7394: * two directions. If you get one direction you can align rubidium@7394: * a second direction in 8 different ways. This enumeration rubidium@7394: * only contains 6 of these 8 differences, but the remaining rubidium@7394: * two can be calculated by adding to differences together. rubidium@7394: * This also means you can add two differences together and rubidium@7394: * get the difference you really want to get. The difference rubidium@7394: * of 45 degrees left + the difference of 45 degrees right results in the rubidium@7394: * difference of 0 degrees. rubidium@7394: * rubidium@7394: * @note To get this mentioned addition of direction you must use rubidium@7394: * modulo DIR_END or use the #ChangeDirDiff(DirDiff, DirDiff) function. rubidium@7394: * @see ChangeDirDiff(DirDiff, DirDiff) rubidium@7394: */ rubidium@6248: enum DirDiff { rubidium@7394: DIRDIFF_SAME = 0, ///< Both directions faces to the same direction rubidium@7394: DIRDIFF_45RIGHT = 1, ///< Angle of 45 degrees right rubidium@7394: DIRDIFF_90RIGHT = 2, ///< Angle of 90 degrees right rubidium@7394: DIRDIFF_REVERSE = 4, ///< One direction is the opposit of the other one rubidium@7394: DIRDIFF_90LEFT = 6, ///< Angle of 90 degrees left rubidium@7394: DIRDIFF_45LEFT = 7 ///< Angle of 45 degrees left rubidium@6248: }; tron@3158: tron@3158: rubidium@7394: /** rubidium@7394: * Enumeration for diagonal directions. rubidium@7394: * rubidium@7394: * This enumeration is used for the 4 direction of the tile-edges. rubidium@7394: */ rubidium@6248: enum DiagDirection { rubidium@7394: DIAGDIR_BEGIN = 0, ///< Used for iterations rubidium@7394: DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor rubidium@7394: DIAGDIR_SE = 1, ///< Southeast rubidium@7394: DIAGDIR_SW = 2, ///< Southwest rubidium@7394: DIAGDIR_NW = 3, ///< Northwest rubidium@7394: DIAGDIR_END, ///< Used for iterations rubidium@7394: INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection rubidium@6248: }; tron@3147: smatz@8279: /** Allow incrementing of DiagDirection variables */ rubidium@5587: DECLARE_POSTFIX_INCREMENT(DiagDirection); rubidium@5587: rubidium@5587: /** Define basic enum properties */ rubidium@5587: template <> struct EnumPropsT : MakeEnumPropsT {}; belugas@6432: typedef TinyEnumT DiagDirectionByte; //typedefing-enumification of DiagDirection rubidium@5587: tron@3147: rubidium@7394: /** rubidium@7394: * Enumeration for the difference between to DiagDirection. rubidium@7394: * rubidium@7394: * As the DiagDirection only contains 4 possible directions the rubidium@7394: * difference between two of these directions can only be in 4 ways. rubidium@7394: * As the DirDiff enumeration the values can be added together and rubidium@7394: * you will get the resulting difference (use modulo DIAGDIR_END). rubidium@7394: * rubidium@7394: * @see DirDiff rubidium@7394: */ rubidium@6248: enum DiagDirDiff { rubidium@7394: DIAGDIRDIFF_SAME = 0, ///< Same directions rubidium@7394: DIAGDIRDIFF_90RIGHT = 1, ///< 90 degrees right rubidium@7394: DIAGDIRDIFF_REVERSE = 2, ///< Reverse directions rubidium@7394: DIAGDIRDIFF_90LEFT = 3 ///< 90 degrees left rubidium@6248: }; tron@3163: rubidium@7641: /** Allow incrementing of DiagDirDiff variables */ rubidium@7641: DECLARE_POSTFIX_INCREMENT(DiagDirDiff); rubidium@7641: tron@3153: rubidium@7394: /** rubidium@7394: * Enumeration for the two axis X and Y rubidium@7394: * rubidium@7394: * This enumeration represente the two axis X and Y in the game. rubidium@7394: * The X axis is the one which goes align the north-west edge rubidium@7394: * (and south-east edge). The Y axis must be so the one which goes rubidium@7394: * align the north-east edge (and south-west) edge. rubidium@7394: */ rubidium@6248: enum Axis { rubidium@7394: AXIS_X = 0, ///< The X axis rubidium@7394: AXIS_Y = 1, ///< The y axis rubidium@7394: AXIS_END ///< Used for iterations rubidium@6248: }; tron@3147: rubidium@8100: #endif /* DIRECTION_TYPE_H */