author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 8734 | cf2c240d2e1b |
child 10207 | c291a21b304e |
permissions | -rw-r--r-- |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
2 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
3 |
/** @file road_func.h Functions related to roads. */ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
4 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
5 |
#ifndef ROAD_FUNC_H |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
6 |
#define ROAD_FUNC_H |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
7 |
|
8113
31b7784db761
(svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents:
8102
diff
changeset
|
8 |
#include "core/bitmath_func.hpp" |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
9 |
#include "road_type.h" |
8138
dbfdc08fa6b9
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium
parents:
8113
diff
changeset
|
10 |
#include "direction_func.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8236
diff
changeset
|
11 |
#include "player_type.h" |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
12 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
13 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
14 |
* Whether the given roadtype is valid. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
15 |
* @param rt the roadtype to check for validness |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
16 |
* @return true if and only if valid |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
17 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
18 |
static inline bool IsValidRoadType(RoadType rt) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
19 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
20 |
return rt == ROADTYPE_ROAD || rt == ROADTYPE_TRAM; |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
21 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
22 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
23 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
24 |
* Are the given bits pointing to valid roadtypes? |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
25 |
* @param rts the roadtypes to check for validness |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
26 |
* @return true if and only if valid |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
27 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
28 |
static inline bool AreValidRoadTypes(RoadTypes rts) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
29 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
30 |
return HasBit(rts, ROADTYPE_ROAD) || HasBit(rts, ROADTYPE_TRAM); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
31 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
32 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
33 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
34 |
* Maps a RoadType to the corresponding RoadTypes value |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
35 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
36 |
* @param rt the roadtype to get the roadtypes from |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
37 |
* @return the roadtypes with the given roadtype |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
38 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
39 |
static inline RoadTypes RoadTypeToRoadTypes(RoadType rt) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
40 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
41 |
return (RoadTypes)(1 << rt); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
42 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
43 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
44 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
45 |
* Returns the RoadTypes which are not present in the given RoadTypes |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
46 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
47 |
* This function returns the complement of a given RoadTypes. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
48 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
49 |
* @param r The given RoadTypes |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
50 |
* @return The complement of the given RoadTypes |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
51 |
* @note The unused value ROADTYPES_HWAY will be used, too. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
52 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
53 |
static inline RoadTypes ComplementRoadTypes(RoadTypes r) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
54 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
55 |
return (RoadTypes)(ROADTYPES_ALL ^ r); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
56 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
57 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
58 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
59 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
60 |
* Calculate the complement of a RoadBits value |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
61 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
62 |
* Simply flips all bits in the RoadBits value to get the complement |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
63 |
* of the RoadBits. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
64 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
65 |
* @param r The given RoadBits value |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
66 |
* @return the complement |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
67 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
68 |
static inline RoadBits ComplementRoadBits(RoadBits r) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
69 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
70 |
return (RoadBits)(ROAD_ALL ^ r); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
71 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
72 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
73 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
74 |
* Calculate the mirrored RoadBits |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
75 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
76 |
* Simply move the bits to their new position. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
77 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
78 |
* @param r The given RoadBits value |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
79 |
* @return the mirrored |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
80 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
81 |
static inline RoadBits MirrorRoadBits(RoadBits r) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
82 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
83 |
return (RoadBits)(GB(r, 0, 2) << 2 | GB(r, 2, 2)); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
84 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
85 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
86 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
87 |
* Calculate rotated RoadBits |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
88 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
89 |
* Move the Roadbits clockwise til they are in their final position. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
90 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
91 |
* @param r The given RoadBits value |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
92 |
* @param rot The given Rotation angle |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
93 |
* @return the rotated |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
94 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
95 |
static inline RoadBits RotateRoadBits(RoadBits r, DiagDirDiff rot) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
96 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
97 |
for (; rot > (DiagDirDiff)0; rot--){ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
98 |
r = (RoadBits)(GB(r, 0, 1) << 3 | GB(r, 1, 3)); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
99 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
100 |
return r; |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
101 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
102 |
|
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
103 |
/** |
8734
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
104 |
* Check if we've got a straight road |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
105 |
* |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
106 |
* @param r The given RoadBits |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
107 |
* @return true if we've got a straight road |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
108 |
*/ |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
109 |
static inline bool IsStraightRoad(RoadBits r) |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
110 |
{ |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
111 |
return (r == ROAD_X || r == ROAD_Y); |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
112 |
} |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
113 |
|
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
114 |
/** |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
115 |
* Create the road-part which belongs to the given DiagDirection |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
116 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
117 |
* This function returns a RoadBits value which belongs to |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
118 |
* the given DiagDirection. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
119 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
120 |
* @param d The DiagDirection |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
121 |
* @return The result RoadBits which the selected road-part set |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
122 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
123 |
static inline RoadBits DiagDirToRoadBits(DiagDirection d) |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
124 |
{ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
125 |
return (RoadBits)(ROAD_NW << (3 ^ d)); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
126 |
} |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
127 |
|
8236
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
128 |
/** |
8716
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
129 |
* Create the road-part which belongs to the given Axis |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
130 |
* |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
131 |
* This function returns a RoadBits value which belongs to |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
132 |
* the given Axis. |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
133 |
* |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
134 |
* @param a The Axis |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
135 |
* @return The result RoadBits which the selected road-part set |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
136 |
*/ |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
137 |
static inline RoadBits AxisToRoadBits(Axis a) |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
138 |
{ |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
139 |
return a == AXIS_X ? ROAD_X : ROAD_Y; |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
140 |
} |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
141 |
|
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8344
diff
changeset
|
142 |
/** |
8236
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
143 |
* Finds out, whether given player has all given RoadTypes available |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
144 |
* @param PlayerID ID of player |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
145 |
* @param rts RoadTypes to test |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
146 |
* @return true if player has all requested RoadTypes available |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
147 |
*/ |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
148 |
bool HasRoadTypesAvail(const PlayerID p, const RoadTypes rts); |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
149 |
|
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
150 |
/** |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
151 |
* Validate functions for rail building. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
152 |
* @param rt road type to check. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
153 |
* @return true if the current player may build the road. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
154 |
*/ |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
155 |
bool ValParamRoadType(const RoadType rt); |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
156 |
|
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
157 |
/** |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
158 |
* Get the road types the given player can build. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
159 |
* @param p the player to get the roadtypes for. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
160 |
* @return the road types. |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
161 |
*/ |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
162 |
RoadTypes GetPlayerRoadtypes(const PlayerID p); |
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8138
diff
changeset
|
163 |
|
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8342
diff
changeset
|
164 |
void UpdateLevelCrossing(TileIndex tile, bool sound = true); |
8342
bf710180e7ce
(svn r11908) -Fix: update crossing when merging a company, when building a crossing and after loading older savegame
smatz
parents:
8254
diff
changeset
|
165 |
|
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
diff
changeset
|
166 |
#endif /* ROAD_FUNC_H */ |