diff options
author | tron <tron@openttd.org> | 2006-03-06 20:28:28 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-06 20:28:28 +0000 |
commit | 2d3c28f2b3d24c2b01e54a51e2dcf5ad7f4851c8 (patch) | |
tree | 410be31dd2267cd8af3257b3d145965515575d34 /direction.h | |
parent | fc1e9c5a92ccfeaea09b1fcd1bb58f1de4cb2644 (diff) | |
download | openttd-2d3c28f2b3d24c2b01e54a51e2dcf5ad7f4851c8.tar.xz |
(svn r3776) Replace many ints and magic numbers by Direction, DiagDirection and friends
Diffstat (limited to 'direction.h')
-rw-r--r-- | direction.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/direction.h b/direction.h index 8a45dc43e..33c465aac 100644 --- a/direction.h +++ b/direction.h @@ -34,12 +34,18 @@ static inline DiagDirection ReverseDiagDir(DiagDirection d) } -static inline DiagDirection DirToDiagdir(Direction dir) +static inline DiagDirection DirToDiagDir(Direction dir) { return (DiagDirection)(dir >> 1); } +static inline Direction DiagDirToDir(DiagDirection dir) +{ + return (Direction)(dir * 2 + 1); +} + + /* the 2 axis */ typedef enum Axis { AXIS_X = 0, |