diff options
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, |