OpenTTD
track_type.h
Go to the documentation of this file.
1 /* $Id: track_type.h 23595 2011-12-19 17:48:04Z rubidium $ */
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 TRACK_TYPE_H
13 #define TRACK_TYPE_H
14 
15 #include "core/enum_type.hpp"
16 
21 enum Track {
23  TRACK_X = 0,
24  TRACK_Y = 1,
27  TRACK_LEFT = 4,
30  INVALID_TRACK = 0xFF,
31 };
32 
36 template <> struct EnumPropsT<Track> : MakeEnumPropsT<Track, byte, TRACK_BEGIN, TRACK_END, INVALID_TRACK, 3> {};
38 
39 
41 enum TrackBits {
43  TRACK_BIT_X = 1U << TRACK_X,
44  TRACK_BIT_Y = 1U << TRACK_Y,
57  TRACK_BIT_MASK = 0x3FU,
59  TRACK_BIT_DEPOT = 0x80U,
61 };
64 
74 enum Trackdir {
94 };
95 
97 template <> struct EnumPropsT<Trackdir> : MakeEnumPropsT<Trackdir, byte, TRACKDIR_BEGIN, TRACKDIR_END, INVALID_TRACKDIR, 4> {};
99 
107  TRACKDIR_BIT_NONE = 0x0000,
108  TRACKDIR_BIT_X_NE = 0x0001,
109  TRACKDIR_BIT_Y_SE = 0x0002,
114  /* Again, note the two missing values here. This enables trackdir -> track conversion by doing (trackdir & 0xFF) */
115  TRACKDIR_BIT_X_SW = 0x0100,
116  TRACKDIR_BIT_Y_NW = 0x0200,
121  TRACKDIR_BIT_MASK = 0x3F3F,
123 };
126 
127 typedef uint32 TrackStatus;
128 
129 #endif /* TRACK_TYPE_H */