author | truebrain |
Mon, 30 Jun 2008 13:51:28 +0000 | |
branch | noai |
changeset 11102 | aacdde10b4ad |
parent 9724 | b39bc69bb2f2 |
permissions | -rw-r--r-- |
9723 | 1 |
/* $Id$ */ |
2 |
||
3 |
/** @file direction_type.h Different types to 'show' directions. */ |
|
4 |
||
5 |
#ifndef DIRECTION_TYPE_H |
|
6 |
#define DIRECTION_TYPE_H |
|
7 |
||
8 |
#include "core/enum_type.hpp" |
|
9 |
||
10 |
/** |
|
11 |
* Defines the 8 directions on the map. |
|
12 |
* |
|
13 |
* This enum defines 8 possible directions which are used for |
|
14 |
* the vehicles in the game. The directions are aligned straight |
|
15 |
* to the viewport, not to the map. So north points to the top of |
|
16 |
* your viewport and not rotated by 45 degrees left or right to get |
|
17 |
* a "north" used in you games. |
|
18 |
*/ |
|
19 |
enum Direction { |
|
20 |
DIR_BEGIN = 0, ///< Used to iterate |
|
21 |
DIR_N = 0, ///< North |
|
22 |
DIR_NE = 1, ///< Northeast |
|
23 |
DIR_E = 2, ///< East |
|
24 |
DIR_SE = 3, ///< Southeast |
|
25 |
DIR_S = 4, ///< South |
|
26 |
DIR_SW = 5, ///< Southwest |
|
27 |
DIR_W = 6, ///< West |
|
28 |
DIR_NW = 7, ///< Northwest |
|
29 |
DIR_END, ///< Used to iterate |
|
30 |
INVALID_DIR = 0xFF, ///< Flag for an invalid direction |
|
31 |
}; |
|
32 |
||
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
33 |
/** Allow incrementing of Direction variables */ |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
34 |
DECLARE_POSTFIX_INCREMENT(Direction); |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
35 |
|
9723 | 36 |
/** Define basic enum properties */ |
37 |
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {}; |
|
38 |
typedef TinyEnumT<Direction> DirectionByte; //typedefing-enumification of Direction |
|
39 |
||
40 |
||
41 |
/** |
|
42 |
* Enumeration for the difference between two directions. |
|
43 |
* |
|
44 |
* This enumeration is used to mark differences between |
|
45 |
* two directions. If you get one direction you can align |
|
46 |
* a second direction in 8 different ways. This enumeration |
|
47 |
* only contains 6 of these 8 differences, but the remaining |
|
48 |
* two can be calculated by adding to differences together. |
|
49 |
* This also means you can add two differences together and |
|
50 |
* get the difference you really want to get. The difference |
|
51 |
* of 45 degrees left + the difference of 45 degrees right results in the |
|
52 |
* difference of 0 degrees. |
|
53 |
* |
|
54 |
* @note To get this mentioned addition of direction you must use |
|
55 |
* modulo DIR_END or use the #ChangeDirDiff(DirDiff, DirDiff) function. |
|
56 |
* @see ChangeDirDiff(DirDiff, DirDiff) |
|
57 |
*/ |
|
58 |
enum DirDiff { |
|
59 |
DIRDIFF_SAME = 0, ///< Both directions faces to the same direction |
|
60 |
DIRDIFF_45RIGHT = 1, ///< Angle of 45 degrees right |
|
61 |
DIRDIFF_90RIGHT = 2, ///< Angle of 90 degrees right |
|
62 |
DIRDIFF_REVERSE = 4, ///< One direction is the opposit of the other one |
|
63 |
DIRDIFF_90LEFT = 6, ///< Angle of 90 degrees left |
|
64 |
DIRDIFF_45LEFT = 7 ///< Angle of 45 degrees left |
|
65 |
}; |
|
66 |
||
67 |
||
68 |
/** |
|
69 |
* Enumeration for diagonal directions. |
|
70 |
* |
|
71 |
* This enumeration is used for the 4 direction of the tile-edges. |
|
72 |
*/ |
|
73 |
enum DiagDirection { |
|
74 |
DIAGDIR_BEGIN = 0, ///< Used for iterations |
|
75 |
DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor |
|
76 |
DIAGDIR_SE = 1, ///< Southeast |
|
77 |
DIAGDIR_SW = 2, ///< Southwest |
|
78 |
DIAGDIR_NW = 3, ///< Northwest |
|
79 |
DIAGDIR_END, ///< Used for iterations |
|
80 |
INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection |
|
81 |
}; |
|
82 |
||
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
83 |
/** Allow incrementing of DiagDirection variables */ |
9723 | 84 |
DECLARE_POSTFIX_INCREMENT(DiagDirection); |
85 |
||
86 |
/** Define basic enum properties */ |
|
87 |
template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR> {}; |
|
88 |
typedef TinyEnumT<DiagDirection> DiagDirectionByte; //typedefing-enumification of DiagDirection |
|
89 |
||
90 |
||
91 |
/** |
|
92 |
* Enumeration for the difference between to DiagDirection. |
|
93 |
* |
|
94 |
* As the DiagDirection only contains 4 possible directions the |
|
95 |
* difference between two of these directions can only be in 4 ways. |
|
96 |
* As the DirDiff enumeration the values can be added together and |
|
97 |
* you will get the resulting difference (use modulo DIAGDIR_END). |
|
98 |
* |
|
99 |
* @see DirDiff |
|
100 |
*/ |
|
101 |
enum DiagDirDiff { |
|
102 |
DIAGDIRDIFF_SAME = 0, ///< Same directions |
|
103 |
DIAGDIRDIFF_90RIGHT = 1, ///< 90 degrees right |
|
104 |
DIAGDIRDIFF_REVERSE = 2, ///< Reverse directions |
|
105 |
DIAGDIRDIFF_90LEFT = 3 ///< 90 degrees left |
|
106 |
}; |
|
107 |
||
108 |
/** Allow incrementing of DiagDirDiff variables */ |
|
109 |
DECLARE_POSTFIX_INCREMENT(DiagDirDiff); |
|
110 |
||
111 |
||
112 |
/** |
|
113 |
* Enumeration for the two axis X and Y |
|
114 |
* |
|
115 |
* This enumeration represente the two axis X and Y in the game. |
|
116 |
* The X axis is the one which goes align the north-west edge |
|
117 |
* (and south-east edge). The Y axis must be so the one which goes |
|
118 |
* align the north-east edge (and south-west) edge. |
|
119 |
*/ |
|
120 |
enum Axis { |
|
121 |
AXIS_X = 0, ///< The X axis |
|
122 |
AXIS_Y = 1, ///< The y axis |
|
123 |
AXIS_END ///< Used for iterations |
|
124 |
}; |
|
125 |
||
126 |
#endif /* DIRECTION_TYPE_H */ |