# direction_type.h

Go to the documentation of this file.

    00001 /* $Id: direction_type.h 19665 2010-04-17 22:27:49Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef DIRECTION_TYPE_H
    00013 #define DIRECTION_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00026 enum Direction {
    00027   DIR_BEGIN = 0,
    00028   DIR_N   = 0,
    00029   DIR_NE  = 1,
    00030   DIR_E   = 2,
    00031   DIR_SE  = 3,
    00032   DIR_S   = 4,
    00033   DIR_SW  = 5,
    00034   DIR_W   = 6,
    00035   DIR_NW  = 7,
    00036   DIR_END,
    00037   INVALID_DIR = 0xFF,
    00038 };
    00039
    00041 DECLARE_POSTFIX_INCREMENT(Direction);
    00042
    00044 template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR, 3> {};
    00045 typedef TinyEnumT<Direction> DirectionByte; // typedefing-enumification of Direction
    00046
    00047
    00065 enum DirDiff {
    00066   DIRDIFF_SAME    = 0,
    00067   DIRDIFF_45RIGHT = 1,
    00068   DIRDIFF_90RIGHT = 2,
    00069   DIRDIFF_REVERSE = 4,
    00070   DIRDIFF_90LEFT  = 6,
    00071   DIRDIFF_45LEFT  = 7
    00072 };
    00073
    00074
    00080 enum DiagDirection {
    00081   DIAGDIR_BEGIN = 0,
    00082   DIAGDIR_NE  = 0,
    00083   DIAGDIR_SE  = 1,
    00084   DIAGDIR_SW  = 2,
    00085   DIAGDIR_NW  = 3,
    00086   DIAGDIR_END,
    00087   INVALID_DIAGDIR = 0xFF,
    00088 };
    00089
    00091 DECLARE_POSTFIX_INCREMENT(DiagDirection);
    00092
    00094 template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR, 2> {};
    00095 typedef TinyEnumT<DiagDirection> DiagDirectionByte; // typedefing-enumification of DiagDirection
    00096
    00097
    00108 enum DiagDirDiff {
    00109   DIAGDIRDIFF_SAME    = 0,
    00110   DIAGDIRDIFF_90RIGHT = 1,
    00111   DIAGDIRDIFF_REVERSE = 2,
    00112   DIAGDIRDIFF_90LEFT  = 3
    00113 };
    00114
    00116 DECLARE_POSTFIX_INCREMENT(DiagDirDiff);
    00117
    00118
    00127 enum Axis {
    00128   AXIS_X = 0,
    00129   AXIS_Y = 1,
    00130   AXIS_END,
    00131   INVALID_AXIS = 0xFF,
    00132 };
    00133 template <> struct EnumPropsT<Axis> : MakeEnumPropsT<Axis, byte, AXIS_X, AXIS_END, INVALID_AXIS, 1> {};
    00134
    00135 #endif /* DIRECTION_TYPE_H */