OpenTTD: src/direction_type.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

direction_type.h
Go to the documentation of this file.
1 /* $Id: direction_type.h 24900 2013-01-08 22:46:42Z planetmaker $ */
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 {
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,
36 DIR_END,
37 INVALID_DIR = 0xFF,
38 };
39
41 DECLARE_POSTFIX_INCREMENT(Direction)
42
43
44 template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR, 3> {};
45 typedef TinyEnumT<Direction> DirectionByte;
46
47
65 enum DirDiff {
66 DIRDIFF_SAME = 0,
67 DIRDIFF_45RIGHT = 1,
68 DIRDIFF_90RIGHT = 2,
69 DIRDIFF_REVERSE = 4,
70 DIRDIFF_90LEFT = 6,
71 DIRDIFF_45LEFT = 7,
72 };
73
74
80 enum DiagDirection {
81 DIAGDIR_BEGIN = 0,
82 DIAGDIR_NE = 0,
83 DIAGDIR_SE = 1,
84 DIAGDIR_SW = 2,
85 DIAGDIR_NW = 3,
86 DIAGDIR_END,
87 INVALID_DIAGDIR = 0xFF,
88 };
89
91 DECLARE_POSTFIX_INCREMENT(DiagDirection)
92
93
94 template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR, 2> {};
95 typedef TinyEnumT<DiagDirection> DiagDirectionByte;
96
97
108 enum DiagDirDiff {
109 DIAGDIRDIFF_SAME = 0,
110 DIAGDIRDIFF_90RIGHT = 1,
111 DIAGDIRDIFF_REVERSE = 2,
112 DIAGDIRDIFF_90LEFT = 3,
113 };
114
116 DECLARE_POSTFIX_INCREMENT(DiagDirDiff)
117
118
119
127 enum Axis {
128 AXIS_X = 0,
129 AXIS_Y = 1,
130 AXIS_END,
131 INVALID_AXIS = 0xFF,
132 };
134 template <> struct EnumPropsT<Axis> : MakeEnumPropsT<Axis, byte, AXIS_X, AXIS_END, INVALID_AXIS, 1> {};
135
136 #endif /* DIRECTION_TYPE_H */