diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | f35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/direction.h | |
parent | a332d10fd938f345fff18e5f4a662a58f692f734 (diff) | |
download | openttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/direction.h')
-rw-r--r-- | src/direction.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/direction.h b/src/direction.h index 477c34046..576d8e1bb 100644 --- a/src/direction.h +++ b/src/direction.h @@ -3,8 +3,11 @@ #ifndef DIRECTION_H #define DIRECTION_H +#include "helpers.hpp" + /* Direction as commonly used in v->direction, 8 way. */ typedef enum Direction { + DIR_BEGIN = 0, DIR_N = 0, DIR_NE = 1, /* Northeast, upper right on your monitor */ DIR_E = 2, @@ -17,6 +20,10 @@ typedef enum Direction { INVALID_DIR = 0xFF, } Direction; +/** Define basic enum properties */ +template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {}; +typedef TinyEnumT<Direction> DirectionByte; + static inline Direction ReverseDir(Direction d) { return (Direction)(4 ^ d); @@ -51,6 +58,7 @@ static inline Direction ChangeDir(Direction d, DirDiff delta) /* Direction commonly used as the direction of entering and leaving tiles, 4-way */ typedef enum DiagDirection { + DIAGDIR_BEGIN = 0, DIAGDIR_NE = 0, /* Northeast, upper right on your monitor */ DIAGDIR_SE = 1, DIAGDIR_SW = 2, @@ -59,6 +67,12 @@ typedef enum DiagDirection { INVALID_DIAGDIR = 0xFF, } DiagDirection; +DECLARE_POSTFIX_INCREMENT(DiagDirection); + +/** Define basic enum properties */ +template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR> {}; +typedef TinyEnumT<DiagDirection> DiagDirectionByte; + static inline DiagDirection ReverseDiagDir(DiagDirection d) { return (DiagDirection)(2 ^ d); |