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