OpenTTD
direction_type.h
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef DIRECTION_TYPE_H
13 #define DIRECTION_TYPE_H
14 
15 #include "core/enum_type.hpp"
16 
26 enum Direction : byte {
27  DIR_BEGIN = 0,
28  DIR_N = 0,
29  DIR_NE = 1,
30  DIR_E = 2,
31  DIR_SE = 3,
32  DIR_S = 4,
33  DIR_SW = 5,
34  DIR_W = 6,
35  DIR_NW = 7,
37  INVALID_DIR = 0xFF,
38 };
39 
42 
43 
45 
46 
64 enum DirDiff {
71 };
72 
73 
79 enum DiagDirection : byte {
81  DIAGDIR_NE = 0,
82  DIAGDIR_SE = 1,
83  DIAGDIR_SW = 2,
84  DIAGDIR_NW = 3,
86  INVALID_DIAGDIR = 0xFF,
87 };
88 
91 
92 
94 
95 
111 };
112 
115 
116 
117 
125 enum Axis {
126  AXIS_X = 0,
127  AXIS_Y = 1,
129  INVALID_AXIS = 0xFF,
130 };
132 template <> struct EnumPropsT<Axis> : MakeEnumPropsT<Axis, byte, AXIS_X, AXIS_END, INVALID_AXIS, 1> {};
133 
134 #endif /* DIRECTION_TYPE_H */
Helper template class that makes basic properties of given enumeration type visible from outsize...
Definition: enum_type.hpp:64
Used to iterate.
Angle of 45 degrees left.
Northwest.
Angle of 90 degrees right.
West.
Used for iterations.
Both directions faces to the same direction.
Flag for an invalid DiagDirection.
Type (helpers) for enums.
Southwest.
North.
Used to iterate.
Angle of 45 degrees right.
90 degrees right
Reverse directions.
Southeast.
The y axis.
East.
Southeast.
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:50
Direction
Defines the 8 directions on the map.
DirDiff
Enumeration for the difference between two directions.
Used for iterations.
South.
DiagDirDiff
Enumeration for the difference between to DiagDirection.
Same directions.
Flag for an invalid direction.
The X axis.
Angle of 90 degrees left.
Used for iterations.
Northwest.
Northeast.
DiagDirection
Enumeration for diagonal directions.
Northeast, upper right on your monitor.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:16
One direction is the opposite of the other one.
Flag for an invalid Axis.
90 degrees left
Axis
Allow incrementing of DiagDirDiff variables.
Southwest.