# rail_type.h

Go to the documentation of this file.

    00001 /* $Id: rail_type.h 17248 2009-08-21 20:21:05Z 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 RAIL_TYPE_H
    00013 #define RAIL_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00017 typedef uint32 RailTypeLabel;
    00018
    00024 enum RailType {
    00025   RAILTYPE_BEGIN    = 0,
    00026   RAILTYPE_RAIL     = 0,
    00027   RAILTYPE_ELECTRIC = 1,
    00028   RAILTYPE_MONO     = 2,
    00029   RAILTYPE_MAGLEV   = 3,
    00030   RAILTYPE_END,
    00031   INVALID_RAILTYPE  = 0xFF,
    00032
    00033   DEF_RAILTYPE_FIRST = RAILTYPE_END,
    00034   DEF_RAILTYPE_LAST,
    00035   DEF_RAILTYPE_MOST_USED,
    00036 };
    00037
    00039 DECLARE_POSTFIX_INCREMENT(RailType);
    00041 template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE> {};
    00042 typedef TinyEnumT<RailType> RailTypeByte;
    00043
    00047 enum RailTypes {
    00048   RAILTYPES_NONE     = 0,
    00049   RAILTYPES_RAIL     = 1 << RAILTYPE_RAIL,
    00050   RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC,
    00051   RAILTYPES_MONO     = 1 << RAILTYPE_MONO,
    00052   RAILTYPES_MAGLEV   = 1 << RAILTYPE_MAGLEV,
    00053   INVALID_RAILTYPES  = UINT_MAX
    00054 };
    00055 DECLARE_ENUM_AS_BIT_SET(RailTypes);
    00056
    00057 #endif /* RAIL_TYPE_H */