OpenTTD Source  20241120-master-g6d3adc6169
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 : uint8_t {
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 
58 enum DirDiff {
65 };
66 
67 
73 enum DiagDirection : uint8_t {
75  DIAGDIR_NE = 0,
76  DIAGDIR_SE = 1,
77  DIAGDIR_SW = 2,
78  DIAGDIR_NW = 3,
80  INVALID_DIAGDIR = 0xFF,
81 };
84 
85 
102 };
103 
106 
107 
108 
116 enum Axis : uint8_t {
117  AXIS_X = 0,
118  AXIS_Y = 1,
120  INVALID_AXIS = 0xFF,
121 };
123 
124 #endif /* DIRECTION_TYPE_H */
Direction
Defines the 8 directions on the map.
@ DIR_BEGIN
Used to iterate.
@ DIR_SW
Southwest.
@ DIR_NW
Northwest.
@ INVALID_DIR
Flag for an invalid direction.
@ DIR_N
North.
@ DIR_SE
Southeast.
@ DIR_S
South.
@ DIR_NE
Northeast.
@ DIR_END
Used to iterate.
@ DIR_W
West.
@ DIR_E
East.
Axis
Allow incrementing of DiagDirDiff variables.
@ INVALID_AXIS
Flag for an invalid Axis.
@ AXIS_END
Used for iterations.
@ AXIS_X
The X axis.
@ AXIS_Y
The y axis.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ DIAGDIR_NW
Northwest.
@ DIAGDIR_SE
Southeast.
@ DIAGDIR_END
Used for iterations.
@ DIAGDIR_BEGIN
Used for iterations.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
@ DIAGDIR_SW
Southwest.
DiagDirDiff
Enumeration for the difference between to DiagDirection.
@ DIAGDIRDIFF_END
Used for iterations.
@ DIAGDIRDIFF_90RIGHT
90 degrees right
@ DIAGDIRDIFF_90LEFT
90 degrees left
@ DIAGDIRDIFF_REVERSE
Reverse directions.
@ DIAGDIRDIFF_SAME
Same directions.
@ DIAGDIRDIFF_BEGIN
Used for iterations.
DirDiff
Allow incrementing of Direction variables.
@ DIRDIFF_90LEFT
Angle of 90 degrees left.
@ DIRDIFF_45LEFT
Angle of 45 degrees left.
@ DIRDIFF_REVERSE
One direction is the opposite of the other one.
@ DIRDIFF_45RIGHT
Angle of 45 degrees right.
@ DIRDIFF_SAME
Both directions faces to the same direction.
@ DIRDIFF_90RIGHT
Angle of 90 degrees right.
Type (helpers) for enums.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:18
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Definition: enum_type.hpp:45