rail_type.h

Go to the documentation of this file.
00001 /* $Id: rail_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 RAIL_TYPE_H
00013 #define RAIL_TYPE_H
00014 
00015 #include "core/enum_type.hpp"
00016 
00017 typedef uint32 RailTypeLabel;
00018 
00019 static const RailTypeLabel RAILTYPE_RAIL_LABEL     = 'RAIL';
00020 static const RailTypeLabel RAILTYPE_ELECTRIC_LABEL = 'ELRL';
00021 static const RailTypeLabel RAILTYPE_MONO_LABEL     = 'MONO';
00022 static const RailTypeLabel RAILTYPE_MAGLEV_LABEL   = 'MGLV';
00023 
00029 enum RailType {
00030   RAILTYPE_BEGIN    = 0,          
00031   RAILTYPE_RAIL     = 0,          
00032   RAILTYPE_ELECTRIC = 1,          
00033   RAILTYPE_MONO     = 2,          
00034   RAILTYPE_MAGLEV   = 3,          
00035   RAILTYPE_END      = 16,         
00036   INVALID_RAILTYPE  = 0xFF,       
00037 
00038   DEF_RAILTYPE_FIRST = RAILTYPE_END, 
00039   DEF_RAILTYPE_LAST,                 
00040   DEF_RAILTYPE_MOST_USED,            
00041 };
00042 
00044 DECLARE_POSTFIX_INCREMENT(RailType);
00046 template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE, 4> {};
00047 typedef TinyEnumT<RailType> RailTypeByte;
00048 
00052 enum RailTypes {
00053   RAILTYPES_NONE     = 0,                      
00054   RAILTYPES_RAIL     = 1 << RAILTYPE_RAIL,     
00055   RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC, 
00056   RAILTYPES_MONO     = 1 << RAILTYPE_MONO,     
00057   RAILTYPES_MAGLEV   = 1 << RAILTYPE_MAGLEV,   
00058   INVALID_RAILTYPES  = UINT_MAX                
00059 };
00060 DECLARE_ENUM_AS_BIT_SET(RailTypes);
00061 
00062 #endif /* RAIL_TYPE_H */

Generated on Sat Nov 20 20:59:07 2010 for OpenTTD by  doxygen 1.6.1