# road_type.h

Go to the documentation of this file.

    00001 /* $Id: road_type.h 23595 2011-12-19 17:48:04Z 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 ROAD_TYPE_H
    00013 #define ROAD_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00022 enum RoadType {
    00023   ROADTYPE_BEGIN = 0,
    00024   ROADTYPE_ROAD = 0,
    00025   ROADTYPE_TRAM = 1,
    00026   ROADTYPE_END,
    00027   INVALID_ROADTYPE = 0xFF,
    00028 };
    00029 DECLARE_POSTFIX_INCREMENT(RoadType)
    00030 template <> struct EnumPropsT<RoadType> : MakeEnumPropsT<RoadType, byte, ROADTYPE_BEGIN, ROADTYPE_END, INVALID_ROADTYPE, 2> {};
    00031
    00036 enum RoadTypes {
    00037   ROADTYPES_NONE     = 0,
    00038   ROADTYPES_ROAD     = 1 << ROADTYPE_ROAD,
    00039   ROADTYPES_TRAM     = 1 << ROADTYPE_TRAM,
    00040   ROADTYPES_ALL      = ROADTYPES_ROAD | ROADTYPES_TRAM,
    00041   ROADTYPES_END,
    00042   INVALID_ROADTYPES  = 0xFF,
    00043 };
    00044 DECLARE_ENUM_AS_BIT_SET(RoadTypes)
    00045 template <> struct EnumPropsT<RoadTypes> : MakeEnumPropsT<RoadTypes, byte, ROADTYPES_NONE, ROADTYPES_END, INVALID_ROADTYPES, 2> {};
    00046 typedef SimpleTinyEnumT<RoadTypes, byte> RoadTypesByte;
    00047
    00048
    00055 enum RoadBits {
    00056   ROAD_NONE = 0U,
    00057   ROAD_NW   = 1U,
    00058   ROAD_SW   = 2U,
    00059   ROAD_SE   = 4U,
    00060   ROAD_NE   = 8U,
    00061   ROAD_X    = ROAD_SW | ROAD_NE,
    00062   ROAD_Y    = ROAD_NW | ROAD_SE,
    00063
    00064   ROAD_N    = ROAD_NE | ROAD_NW,
    00065   ROAD_E    = ROAD_NE | ROAD_SE,
    00066   ROAD_S    = ROAD_SE | ROAD_SW,
    00067   ROAD_W    = ROAD_NW | ROAD_SW,
    00068
    00069   ROAD_ALL  = ROAD_X  | ROAD_Y,
    00070
    00071   ROAD_END  = ROAD_ALL + 1,
    00072 };
    00073 DECLARE_ENUM_AS_BIT_SET(RoadBits)
    00074 template <> struct EnumPropsT<RoadBits> : MakeEnumPropsT<RoadBits, byte, ROAD_NONE, ROAD_END, ROAD_NONE, 4> {};
    00075
    00076 #endif /* ROAD_TYPE_H */