author | celestar |
Wed, 13 Jun 2007 11:45:14 +0000 | |
branch | gamebalance |
changeset 9911 | 0b8b245a2391 |
parent 9908 | 0fa543611bbe |
child 9912 | 1ac8aac92385 |
permissions | -rw-r--r-- |
3069
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
2 |
|
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
3 |
/** @file road_map.h */ |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
4 |
|
3145
349b745dfbf4
(svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents:
3144
diff
changeset
|
5 |
#ifndef ROAD_MAP_H |
349b745dfbf4
(svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents:
3144
diff
changeset
|
6 |
#define ROAD_MAP_H |
3069
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
7 |
|
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
8 |
#include "macros.h" |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
9 |
#include "rail.h" |
3518
53847cf852c6
(svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373
tron
parents:
3497
diff
changeset
|
10 |
#include "road.h" |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
11 |
#include "tile.h" |
3069
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
12 |
|
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
13 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6498
diff
changeset
|
14 |
enum RoadTileType { |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
15 |
ROAD_TILE_NORMAL, |
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
16 |
ROAD_TILE_CROSSING, |
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
17 |
ROAD_TILE_DEPOT |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6498
diff
changeset
|
18 |
}; |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
19 |
|
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
20 |
static inline RoadTileType GetRoadTileType(TileIndex t) |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
21 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
22 |
assert(IsTileType(t, MP_STREET)); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
23 |
return (RoadTileType)GB(_m[t].m5, 6, 2); |
3150
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
24 |
} |
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
25 |
|
3497
b3b7e1664379
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
26 |
static inline bool IsLevelCrossing(TileIndex t) |
b3b7e1664379
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
27 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
28 |
return GetRoadTileType(t) == ROAD_TILE_CROSSING; |
3497
b3b7e1664379
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
29 |
} |
b3b7e1664379
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
30 |
|
3560
4389ae5ad967
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
31 |
static inline bool IsLevelCrossingTile(TileIndex t) |
4389ae5ad967
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
32 |
{ |
4389ae5ad967
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
33 |
return IsTileType(t, MP_STREET) && IsLevelCrossing(t); |
4389ae5ad967
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
34 |
} |
3150
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
35 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
36 |
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt) |
3272
7e556f209503
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
37 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
38 |
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
39 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
40 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
41 |
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m4, 0, 4); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
42 |
case ROADTYPE_TRAM: return (RoadBits)GB(_m[t].m4, 4, 4); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
43 |
case ROADTYPE_HWAY: return (RoadBits)GB(_m[t].m6, 2, 4); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
44 |
} |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
45 |
} |
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
46 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
47 |
static inline RoadBits GetAllRoadBits(TileIndex tile) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
48 |
{ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
49 |
return GetRoadBits(tile, ROADTYPE_ROAD) | GetRoadBits(tile, ROADTYPE_TRAM) | GetRoadBits(tile, ROADTYPE_HWAY); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
50 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
51 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
52 |
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt) |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
53 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
54 |
assert(GetRoadTileType(t) == ROAD_TILE_NORMAL); // XXX incomplete |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
55 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
56 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
57 |
case ROADTYPE_ROAD: SB(_m[t].m4, 0, 4, r); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
58 |
case ROADTYPE_TRAM: SB(_m[t].m4, 4, 4, r); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
59 |
case ROADTYPE_HWAY: SB(_m[t].m6, 2, 4, r); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
60 |
} |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
61 |
} |
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
62 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
63 |
static inline RoadTypes GetRoadTypes(TileIndex t) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
64 |
{ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
65 |
if (IsTileType(t, MP_STREET)) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
66 |
return (RoadTypes)GB(_me[t].m7, 5, 3); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
67 |
} else { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
68 |
return (RoadTypes)GB(_m[t].m3, 0, 3); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
69 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
70 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
71 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
72 |
static inline void SetRoadTypes(TileIndex t, RoadTypes rt) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
73 |
{ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
74 |
if (IsTileType(t, MP_STREET)) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
75 |
SB(_me[t].m7, 5, 3, rt); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
76 |
} else { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
77 |
assert(IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
78 |
SB(_m[t].m3, 0, 2, rt); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
79 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
80 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
81 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
82 |
static inline Owner GetRoadOwner(TileIndex t, RoadType rt) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
83 |
{ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
84 |
if (!IsTileType(t, MP_STREET)) return GetTileOwner(t); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
85 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
86 |
switch (GetRoadTileType(t)) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
87 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
88 |
case ROAD_TILE_NORMAL: |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
89 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
90 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
91 |
case ROADTYPE_ROAD: return (Owner)GB( _m[t].m1, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
92 |
case ROADTYPE_TRAM: return (Owner)GB( _m[t].m5, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
93 |
case ROADTYPE_HWAY: return (Owner)GB(_me[t].m7, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
94 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
95 |
case ROAD_TILE_CROSSING: |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
96 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
97 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
98 |
case ROADTYPE_ROAD: return (Owner)GB( _m[t].m4, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
99 |
case ROADTYPE_TRAM: return (Owner)GB( _m[t].m5, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
100 |
case ROADTYPE_HWAY: return (Owner)GB(_me[t].m7, 0, 5); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
101 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
102 |
case ROAD_TILE_DEPOT: return GetTileOwner(t); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
103 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
104 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
105 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
106 |
static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o) |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
107 |
{ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
108 |
if (!IsTileType(t, MP_STREET)) return SetTileOwner(t, o); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
109 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
110 |
switch (GetRoadTileType(t)) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
111 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
112 |
case ROAD_TILE_NORMAL: |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
113 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
114 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
115 |
case ROADTYPE_ROAD: SB( _m[t].m1, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
116 |
case ROADTYPE_TRAM: SB( _m[t].m5, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
117 |
case ROADTYPE_HWAY: SB(_me[t].m7, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
118 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
119 |
break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
120 |
case ROAD_TILE_CROSSING: |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
121 |
switch (rt) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
122 |
default: NOT_REACHED(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
123 |
case ROADTYPE_ROAD: SB( _m[t].m4, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
124 |
case ROADTYPE_TRAM: SB( _m[t].m5, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
125 |
case ROADTYPE_HWAY: SB(_me[t].m7, 0, 5, o); break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
126 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
127 |
break; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
128 |
case ROAD_TILE_DEPOT: return SetTileOwner(t, o); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
129 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
130 |
} |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
131 |
|
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
132 |
static inline Axis GetCrossingRoadAxis(TileIndex t) |
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
133 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
134 |
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
135 |
return (Axis)GB(_m[t].m4, 6, 1); |
3272
7e556f209503
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
136 |
} |
7e556f209503
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
137 |
|
3070
512f72481fd9
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
138 |
static inline RoadBits GetCrossingRoadBits(TileIndex tile) |
512f72481fd9
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
139 |
{ |
3272
7e556f209503
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
140 |
return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y; |
3070
512f72481fd9
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
141 |
} |
512f72481fd9
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
142 |
|
3103
fb7f22d3bc9b
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
143 |
static inline TrackBits GetCrossingRailBits(TileIndex tile) |
fb7f22d3bc9b
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
144 |
{ |
4158 | 145 |
return AxisToTrackBits(OtherAxis(GetCrossingRoadAxis(tile))); |
3103
fb7f22d3bc9b
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
146 |
} |
fb7f22d3bc9b
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
147 |
|
fb7f22d3bc9b
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
148 |
|
3322
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
149 |
static inline void UnbarCrossing(TileIndex t) |
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
150 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
151 |
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
152 |
CLRBIT(_m[t].m4, 5); |
3322
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
153 |
} |
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
154 |
|
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
155 |
static inline void BarCrossing(TileIndex t) |
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
156 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
157 |
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
158 |
SETBIT(_m[t].m4, 5); |
3322
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
159 |
} |
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
160 |
|
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
161 |
static inline bool IsCrossingBarred(TileIndex t) |
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
162 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
163 |
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
164 |
return HASBIT(_m[t].m4, 5); |
3322
fa5d46929db9
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
165 |
} |
3274 | 166 |
|
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
167 |
#define IsOnDesert IsOnSnow |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
168 |
static inline bool IsOnSnow(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
169 |
{ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
170 |
return HASBIT(_m[t].m3, 7); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
171 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
172 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
173 |
#define ToggleDesert ToggleSnow |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
174 |
static inline void ToggleSnow(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
175 |
{ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
176 |
TOGGLEBIT(_m[t].m3, 7); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
177 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
178 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
179 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6498
diff
changeset
|
180 |
enum Roadside { |
4048 | 181 |
ROADSIDE_BARREN = 0, |
182 |
ROADSIDE_GRASS = 1, |
|
183 |
ROADSIDE_PAVED = 2, |
|
184 |
ROADSIDE_STREET_LIGHTS = 3, |
|
185 |
ROADSIDE_TREES = 5, |
|
186 |
ROADSIDE_GRASS_ROAD_WORKS = 6, |
|
187 |
ROADSIDE_PAVED_ROAD_WORKS = 7 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6498
diff
changeset
|
188 |
}; |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
189 |
|
4048 | 190 |
static inline Roadside GetRoadside(TileIndex tile) |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
191 |
{ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
192 |
return (Roadside)GB(_m[tile].m3, 4, 3); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
193 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
194 |
|
4048 | 195 |
static inline void SetRoadside(TileIndex tile, Roadside s) |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
196 |
{ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
197 |
SB(_m[tile].m3, 4, 3, s); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
198 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
199 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
200 |
static inline bool HasRoadWorks(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
201 |
{ |
4048 | 202 |
return GetRoadside(t) >= ROADSIDE_GRASS_ROAD_WORKS; |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
203 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
204 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
205 |
static inline bool IncreaseRoadWorksCounter(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
206 |
{ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
207 |
AB(_m[t].m3, 0, 4, 1); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
208 |
|
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
209 |
return GB(_m[t].m3, 0, 4) == 15; |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
210 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
211 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
212 |
static inline void StartRoadWorks(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
213 |
{ |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
214 |
assert(!HasRoadWorks(t)); |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
215 |
/* Remove any trees or lamps in case or roadwork */ |
4048 | 216 |
switch (GetRoadside(t)) { |
217 |
case ROADSIDE_BARREN: |
|
218 |
case ROADSIDE_GRASS: SetRoadside(t, ROADSIDE_GRASS_ROAD_WORKS); break; |
|
219 |
default: SetRoadside(t, ROADSIDE_PAVED_ROAD_WORKS); break; |
|
4045
e85dc17faa9f
(svn r5314) -Regression: When road works started on a road tile with barren roadside the road side turned into trees (caused by r4258)
tron
parents:
4000
diff
changeset
|
220 |
} |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
221 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
222 |
|
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
223 |
static inline void TerminateRoadWorks(TileIndex t) |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
224 |
{ |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
225 |
assert(HasRoadWorks(t)); |
4048 | 226 |
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS)); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
227 |
/* Stop the counter */ |
6498
aff910a05c6e
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5726
diff
changeset
|
228 |
SB(_m[t].m3, 0, 4, 0); |
3430
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
229 |
} |
b283bb956a36
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
230 |
|
3069
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
231 |
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
232 |
static inline DiagDirection GetRoadDepotDirection(TileIndex t) |
3069
0e6aca11c3da
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
233 |
{ |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
234 |
assert(GetRoadTileType(t) == ROAD_TILE_DEPOT); |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
235 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
3167
197b5ee5a831
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
236 |
} |
197b5ee5a831
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
237 |
|
197b5ee5a831
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
238 |
|
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
239 |
/** |
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
240 |
* Returns the RoadBits on an arbitrary tile |
9907
3b068c3a1c74
(svn r9675) [gamebalance] -Sync: r9420:9520 from trunk
celestar
parents:
9895
diff
changeset
|
241 |
* Special behaviour: |
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
242 |
* - road depots: entrance is treated as road piece |
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
243 |
* - road tunnels: entrance is treated as road piece |
3196 | 244 |
* - bridge ramps: start of the ramp is treated as road piece |
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
245 |
* - bridge middle parts: bridge itself is ignored |
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
246 |
* @param tile the tile to get the road bits for |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
247 |
* @param rt the road type to get the road bits form |
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
248 |
* @return the road bits of the given tile |
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
249 |
*/ |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
250 |
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt); |
3146
36523d434783
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
251 |
|
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
252 |
/** |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
253 |
* Get the accessible track bits for the given tile. |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
254 |
* Special behaviour: |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
255 |
* - road depots: no track bits |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
256 |
* - non-drive-through stations: no track bits |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
257 |
* @param tile the tile to get the track bits for |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
258 |
* @return the track bits for the given tile |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9907
diff
changeset
|
259 |
*/ |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
260 |
TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt); |
3150
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
261 |
|
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
262 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
263 |
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway) |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
264 |
{ |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
265 |
SetTileType(t, MP_STREET); |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
266 |
SetTileOwner(t, road); |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
267 |
_m[t].m2 = town; |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
268 |
_m[t].m3 = 0; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
269 |
_m[t].m4 = (HASBIT(rot, ROADTYPE_TRAM) ? bits : 0) << 4 | (HASBIT(rot, ROADTYPE_ROAD) ? bits : 0); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
270 |
_m[t].m5 = ROAD_TILE_NORMAL << 6 | tram; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
271 |
SB(_m[t].m6, 2, 4, HASBIT(rot, ROADTYPE_HWAY) ? bits : 0); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
272 |
_me[t].m7 = rot << 5 | hway; |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
273 |
} |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
274 |
|
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
275 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
276 |
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner hway, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town) |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
277 |
{ |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
278 |
SetTileType(t, MP_STREET); |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
279 |
SetTileOwner(t, rail); |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
280 |
_m[t].m2 = town; |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
281 |
_m[t].m3 = rat; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
282 |
_m[t].m4 = roaddir << 6 | road; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
283 |
_m[t].m5 = ROAD_TILE_CROSSING << 6 | tram; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
284 |
SB(_m[t].m6, 2, 4, 0); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
285 |
_me[t].m7 = rot << 5 | hway; |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
286 |
} |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
287 |
|
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
288 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
289 |
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir, RoadType rt) |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
290 |
{ |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
291 |
SetTileType(t, MP_STREET); |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
292 |
SetTileOwner(t, owner); |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
293 |
_m[t].m2 = 0; |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
294 |
_m[t].m3 = 0; |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
295 |
_m[t].m4 = 0; |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
296 |
_m[t].m5 = ROAD_TILE_DEPOT << 6 | dir; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
297 |
SB(_m[t].m6, 2, 4, 0); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
298 |
_me[t].m7 = RoadTypeToRoadTypes(rt) << 5; |
3099
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
299 |
} |
374e275300e3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
300 |
|
4666
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4158
diff
changeset
|
301 |
#endif /* ROAD_MAP_H */ |