OpenTTD
direction_type.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef DIRECTION_TYPE_H
11 #define DIRECTION_TYPE_H
12 
13 #include "core/enum_type.hpp"
14 
24 enum Direction : byte {
25  DIR_BEGIN = 0,
26  DIR_N = 0,
27  DIR_NE = 1,
28  DIR_E = 2,
29  DIR_SE = 3,
30  DIR_S = 4,
31  DIR_SW = 5,
32  DIR_W = 6,
33  DIR_NW = 7,
35  INVALID_DIR = 0xFF,
36 };
37 
40 
41 
43 
44 
62 enum DirDiff {
69 };
70 
71 
77 enum DiagDirection : byte {
79  DIAGDIR_NE = 0,
80  DIAGDIR_SE = 1,
81  DIAGDIR_SW = 2,
82  DIAGDIR_NW = 3,
84  INVALID_DIAGDIR = 0xFF,
85 };
86 
89 
90 
92 
93 
109 };
110 
113 
114 
115 
123 enum Axis {
124  AXIS_X = 0,
125  AXIS_Y = 1,
127  INVALID_AXIS = 0xFF,
128 };
130 template <> struct EnumPropsT<Axis> : MakeEnumPropsT<Axis, byte, AXIS_X, AXIS_END, INVALID_AXIS, 1> {};
131 
132 #endif /* DIRECTION_TYPE_H */
Helper template class that makes basic properties of given enumeration type visible from outsize...
Definition: enum_type.hpp:62
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:48
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:14
One direction is the opposite of the other one.
Flag for an invalid Axis.
90 degrees left
Axis
Allow incrementing of DiagDirDiff variables.
Southwest.