src/road_type.h
branchNewGRF_ports
changeset 6872 1c4a4a609f85
equal deleted inserted replaced
6871:5a9dc001e1ad 6872:1c4a4a609f85
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file road_type.h Enums and other types related to roads. */
       
     4 
       
     5 #ifndef ROAD_TYPE_H
       
     6 #define ROAD_TYPE_H
       
     7 
       
     8 #include "core/enum_type.hpp"
       
     9 
       
    10 /**
       
    11  * The different roadtypes we support
       
    12  *
       
    13  * @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
       
    14  */
       
    15 enum RoadType {
       
    16 	ROADTYPE_ROAD = 0,      ///< Basic road type
       
    17 	ROADTYPE_TRAM = 1,      ///< Trams
       
    18 	ROADTYPE_HWAY = 2,      ///< Only a placeholder. Not sure what we are going to do with this road type.
       
    19 	ROADTYPE_END,           ///< Used for iterations
       
    20 	INVALID_ROADTYPE = 0xFF ///< flag for invalid roadtype
       
    21 };
       
    22 DECLARE_POSTFIX_INCREMENT(RoadType);
       
    23 
       
    24 /**
       
    25  * The different roadtypes we support, but then a bitmask of them
       
    26  * @note currently only roadtypes with ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
       
    27  */
       
    28 enum RoadTypes {
       
    29 	ROADTYPES_NONE     = 0,                                                 ///< No roadtypes
       
    30 	ROADTYPES_ROAD     = 1 << ROADTYPE_ROAD,                                ///< Road
       
    31 	ROADTYPES_TRAM     = 1 << ROADTYPE_TRAM,                                ///< Trams
       
    32 	ROADTYPES_HWAY     = 1 << ROADTYPE_HWAY,                                ///< Highway (or whatever substitute)
       
    33 	ROADTYPES_ROADTRAM = ROADTYPES_ROAD | ROADTYPES_TRAM,                   ///< Road + trams
       
    34 	ROADTYPES_ROADHWAY = ROADTYPES_ROAD | ROADTYPES_HWAY,                   ///< Road + highway (or whatever substitute)
       
    35 	ROADTYPES_TRAMHWAY = ROADTYPES_TRAM | ROADTYPES_HWAY,                   ///< Trams + highway (or whatever substitute)
       
    36 	ROADTYPES_ALL      = ROADTYPES_ROAD | ROADTYPES_TRAM | ROADTYPES_HWAY,  ///< Road + trams + highway (or whatever substitute)
       
    37 	ROADTYPES_END,                                                          ///< Used for iterations?
       
    38 	INVALID_ROADTYPES  = 0xFF                                               ///< Invalid roadtypes
       
    39 };
       
    40 DECLARE_ENUM_AS_BIT_SET(RoadTypes);
       
    41 template <> struct EnumPropsT<RoadTypes> : MakeEnumPropsT<RoadTypes, byte, ROADTYPES_NONE, ROADTYPES_END, INVALID_ROADTYPES> {};
       
    42 typedef TinyEnumT<RoadTypes> RoadTypesByte;
       
    43 
       
    44 
       
    45 /**
       
    46  * Enumeration for the road parts on a tile.
       
    47  *
       
    48  * This enumeration defines the possible road parts which
       
    49  * can be build on a tile.
       
    50  */
       
    51 enum RoadBits {
       
    52 	ROAD_NONE = 0U,                  ///< No road-part is build
       
    53 	ROAD_NW   = 1U,                  ///< North-west part
       
    54 	ROAD_SW   = 2U,                  ///< South-west part
       
    55 	ROAD_SE   = 4U,                  ///< South-east part
       
    56 	ROAD_NE   = 8U,                  ///< North-east part
       
    57 	ROAD_X    = ROAD_SW | ROAD_NE,   ///< Full road along the x-axis (south-west + north-east)
       
    58 	ROAD_Y    = ROAD_NW | ROAD_SE,   ///< Full road along the y-axis (north-west + south-east)
       
    59 	ROAD_ALL  = ROAD_X  | ROAD_Y     ///< Full 4-way crossing
       
    60 };
       
    61 DECLARE_ENUM_AS_BIT_SET(RoadBits);
       
    62 
       
    63 #endif /* ROAD_TYPE_H */