diff options
author | matthijs <matthijs@openttd.org> | 2006-05-01 09:34:23 +0000 |
---|---|---|
committer | matthijs <matthijs@openttd.org> | 2006-05-01 09:34:23 +0000 |
commit | daef7e410c9f84e36dddd677f4a2e7124ccae9e7 (patch) | |
tree | da7831369495881ba17fb8ab0c61f332499bafee /direction.h | |
parent | 5c677d49f47011769c56c6019d2ae180d852778c (diff) | |
download | openttd-daef7e410c9f84e36dddd677f4a2e7124ccae9e7.tar.xz |
(svn r4640) - Add: IsValidDiagDirection, IsValidDirection and IsValidAxis functions.
- Codechange: Use IsValidDiagDirection() in CmdBuildRoadStop().
Diffstat (limited to 'direction.h')
-rw-r--r-- | direction.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/direction.h b/direction.h index c7a8498f6..ba3213896 100644 --- a/direction.h +++ b/direction.h @@ -93,7 +93,8 @@ static inline Direction DiagDirToDir(DiagDirection dir) /* the 2 axis */ typedef enum Axis { AXIS_X = 0, - AXIS_Y = 1 + AXIS_Y = 1, + AXIS_END } Axis; @@ -112,4 +113,19 @@ static inline DiagDirection AxisToDiagDir(Axis a) return (DiagDirection)(2 - a); } +static inline bool IsValidDiagDirection(DiagDirection d) +{ + return d < DIAGDIR_END; +} + +static inline bool IsValidDirection(DiagDirection d) +{ + return d < DIR_END; +} + +static inline bool IsValidAxis(DiagDirection d) +{ + return d < AXIS_END; +} + #endif |