Mercurial > hg > openttd
annotate src/road_type.h @ 9436:b3969ef775ba draft
(svn r13351) -Codechange: disable warnings about unused variable for builds without asserts
author | smatz <smatz@openttd.org> |
---|---|
date | Sun, 01 Jun 2008 15:08:14 +0000 |
parents | 1a20ebc6285e |
children | a348159c1eca |
rev | line source |
---|---|
8102
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
8348
1a20ebc6285e
(svn r11914) -Documentation: fix some @file statement
glx <glx@openttd.org>
parents:
8236
diff
changeset
|
3 /** @file road_type.h Enums and other types related to roads. */ |
8102
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
4 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
5 #ifndef ROAD_TYPE_H |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
6 #define ROAD_TYPE_H |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
7 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
8 #include "core/enum_type.hpp" |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
9 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 * The different roadtypes we support |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 * |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 * @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported. |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 */ |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 enum RoadType { |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
16 ROADTYPE_ROAD = 0, ///< Basic road type |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 ROADTYPE_TRAM = 1, ///< Trams |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
18 ROADTYPE_HWAY = 2, ///< Only a placeholder. Not sure what we are going to do with this road type. |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 ROADTYPE_END, ///< Used for iterations |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 INVALID_ROADTYPE = 0xFF ///< flag for invalid roadtype |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 }; |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 DECLARE_POSTFIX_INCREMENT(RoadType); |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 /** |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 * The different roadtypes we support, but then a bitmask of them |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
26 * @note currently only roadtypes with ROADTYPE_ROAD and ROADTYPE_TRAM are supported. |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 */ |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 enum RoadTypes { |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 ROADTYPES_NONE = 0, ///< No roadtypes |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 ROADTYPES_ROAD = 1 << ROADTYPE_ROAD, ///< Road |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 ROADTYPES_TRAM = 1 << ROADTYPE_TRAM, ///< Trams |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 ROADTYPES_HWAY = 1 << ROADTYPE_HWAY, ///< Highway (or whatever substitute) |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 ROADTYPES_ROADTRAM = ROADTYPES_ROAD | ROADTYPES_TRAM, ///< Road + trams |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 ROADTYPES_ROADHWAY = ROADTYPES_ROAD | ROADTYPES_HWAY, ///< Road + highway (or whatever substitute) |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 ROADTYPES_TRAMHWAY = ROADTYPES_TRAM | ROADTYPES_HWAY, ///< Trams + highway (or whatever substitute) |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 ROADTYPES_ALL = ROADTYPES_ROAD | ROADTYPES_TRAM | ROADTYPES_HWAY, ///< Road + trams + highway (or whatever substitute) |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8102
diff
changeset
|
37 ROADTYPES_END, ///< Used for iterations? |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8102
diff
changeset
|
38 INVALID_ROADTYPES = 0xFF ///< Invalid roadtypes |
8102
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 }; |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 DECLARE_ENUM_AS_BIT_SET(RoadTypes); |
8236
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8102
diff
changeset
|
41 template <> struct EnumPropsT<RoadTypes> : MakeEnumPropsT<RoadTypes, byte, ROADTYPES_NONE, ROADTYPES_END, INVALID_ROADTYPES> {}; |
d1191295967a
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents:
8102
diff
changeset
|
42 typedef TinyEnumT<RoadTypes> RoadTypesByte; |
8102
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
43 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
44 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
45 /** |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
46 * Enumeration for the road parts on a tile. |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
47 * |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
48 * This enumeration defines the possible road parts which |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
49 * can be build on a tile. |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
50 */ |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
51 enum RoadBits { |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
52 ROAD_NONE = 0U, ///< No road-part is build |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
53 ROAD_NW = 1U, ///< North-west part |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
54 ROAD_SW = 2U, ///< South-west part |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
55 ROAD_SE = 4U, ///< South-east part |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
56 ROAD_NE = 8U, ///< North-east part |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 ROAD_X = ROAD_SW | ROAD_NE, ///< Full road along the x-axis (south-west + north-east) |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
58 ROAD_Y = ROAD_NW | ROAD_SE, ///< Full road along the y-axis (north-west + south-east) |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
59 ROAD_ALL = ROAD_X | ROAD_Y ///< Full 4-way crossing |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
60 }; |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
61 DECLARE_ENUM_AS_BIT_SET(RoadBits); |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
62 |
afb4c7da91df
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
63 #endif /* ROAD_TYPE_H */ |