author | celestar |
Sat, 30 Dec 2006 17:09:30 +0000 | |
branch | custombridgeheads |
changeset 5606 | a8e391b7b10a |
parent 5601 | 51f241d43769 |
child 5632 | 025c3b25f1fd |
permissions | -rw-r--r-- |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
2 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
3 |
#ifndef BRIDGE_MAP_H |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
4 |
#define BRIDGE_MAP_H |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
5 |
|
3196 | 6 |
#include "direction.h" |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
7 |
#include "macros.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
8 |
#include "map.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
9 |
#include "rail.h" |
3234
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
10 |
#include "road_map.h" |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
11 |
#include "tile.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
12 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
13 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
14 |
void DrawBridgeMiddle(const TileInfo* ti); // XXX |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
15 |
|
5601
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
16 |
#define M(x) (1 << (x)) |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
17 |
enum { |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
18 |
// foundation, whole tile is leveled up --> 3 corners raised |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
19 |
BRIDGE_FULL_LEVELED_FOUNDATION = M(SLOPE_WSE) | M(SLOPE_NWS) | M(SLOPE_ENW) | M(SLOPE_SEN), |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
20 |
// foundation, tile is partly leveled up --> 1 corner raised |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
21 |
BRIDGE_PARTLY_LEVELED_FOUNDATION = M(SLOPE_W) | M(SLOPE_S) | M(SLOPE_E) | M(SLOPE_N), |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
22 |
// no foundations (X,Y direction) |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
23 |
BRIDGE_NO_FOUNDATION = M(SLOPE_FLAT) | M(SLOPE_SW) | M(SLOPE_SE) | M(SLOPE_NW) | M(SLOPE_NE), |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
24 |
BRIDGE_HORZ_RAMP = (BRIDGE_PARTLY_LEVELED_FOUNDATION | BRIDGE_NO_FOUNDATION) & ~M(SLOPE_FLAT) |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
25 |
}; |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
26 |
#undef M |
51f241d43769
(svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools
celestar
parents:
5600
diff
changeset
|
27 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
28 |
|
5591
8cd83b10634f
(svn r7598) [cbh] - Codechange: Remove the functions IsTunnel() and IsBridge() as they are no longer needed.
celestar
parents:
5590
diff
changeset
|
29 |
static inline bool IsBridgeTile(TileIndex t) |
3234
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
30 |
{ |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
31 |
return IsTileType(t, MP_STREET_BRIDGE) || IsTileType(t, MP_RAILWAY_BRIDGE); |
3234
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
32 |
} |
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
33 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
34 |
static inline bool MayHaveBridgeAbove(TileIndex t) |
3214
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
35 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
36 |
return |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
37 |
IsTileType(t, MP_CLEAR) || |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
38 |
IsTileType(t, MP_RAILWAY) || |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
39 |
IsTileType(t, MP_STREET) || |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
40 |
IsTileType(t, MP_WATER) || |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
41 |
IsTileType(t, MP_TUNNEL) || |
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
42 |
IsTileType(t, MP_STREET_BRIDGE) || |
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
43 |
IsTileType(t, MP_RAILWAY_BRIDGE) || |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
44 |
IsTileType(t, MP_UNMOVABLE); |
3225
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
45 |
} |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
46 |
|
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
47 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
48 |
static inline bool IsBridgeAbove(TileIndex t) |
3933 | 49 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
50 |
assert(MayHaveBridgeAbove(t)); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
51 |
return GB(_m[t].extra, 6, 2) != 0; |
3231
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
52 |
} |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
53 |
|
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
54 |
|
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
55 |
/** |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
56 |
* Determines the type of bridge on a tile |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
57 |
* @param tile The tile to analyze |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
58 |
* @return The bridge type |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
59 |
*/ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
60 |
static inline uint GetBridgeType(TileIndex t) |
3231
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
61 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
62 |
assert(IsBridgeTile(t)); |
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
63 |
return GB(_m[t].m2, 4, 4); |
3231
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
64 |
} |
eb74c2e361f9
(svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents:
3226
diff
changeset
|
65 |
|
3214
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
66 |
|
3196 | 67 |
/** |
68 |
* Get the direction pointing onto the bridge |
|
69 |
*/ |
|
70 |
static inline DiagDirection GetBridgeRampDirection(TileIndex t) |
|
71 |
{ |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
72 |
assert(IsBridgeTile(t)); |
5596
fdbe3e553294
(svn r7614) [cbh] - Codechange: Moved the DiagDirection of the bridge head from m5 bits 0..1 to m4 bits 5..6
celestar
parents:
5592
diff
changeset
|
73 |
return (DiagDirection)GB(_m[t].m4, 5, 2); |
3196 | 74 |
} |
75 |
||
76 |
||
3225
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
77 |
static inline Axis GetBridgeAxis(TileIndex t) |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
78 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
79 |
assert(IsBridgeAbove(t)); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
80 |
return (Axis)(GB(_m[t].extra, 6, 2) - 1); |
3225
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
81 |
} |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
82 |
|
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
83 |
|
3234
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
84 |
static inline TransportType GetBridgeTransportType(TileIndex t) |
986c30171e92
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3231
diff
changeset
|
85 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
86 |
assert(IsBridgeTile(t)); |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
87 |
if (IsTileType(t, MP_STREET_BRIDGE)) return TRANSPORT_ROAD; |
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
88 |
|
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
89 |
return TRANSPORT_RAIL; |
3977
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
90 |
} |
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
91 |
|
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
92 |
|
5592
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
93 |
static inline bool HasBridgeSnowOrDesert(TileIndex t) |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
94 |
{ |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
95 |
assert(IsBridgeTile(t)); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
96 |
return HASBIT(_m[t].m4, 7); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
97 |
} |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
98 |
|
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
99 |
|
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
100 |
static inline void SetBridgeSnowOrDesert(TileIndex t, bool snow_or_desert) |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
101 |
{ |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
102 |
assert(IsBridgeTile(t)); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
103 |
SB(_m[t].m4, 7, 1, snow_or_desert); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
104 |
} |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
105 |
|
3214
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
106 |
/** |
3225
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
107 |
* Finds the end of a bridge in the specified direction starting at a middle tile |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
108 |
*/ |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
109 |
TileIndex GetBridgeEnd(TileIndex, DiagDirection); |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
110 |
|
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
111 |
/** |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
112 |
* Finds the northern end of a bridge starting at a middle tile |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
113 |
*/ |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
114 |
TileIndex GetNorthernBridgeEnd(TileIndex t); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
115 |
|
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
116 |
/** |
3225
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
117 |
* Finds the southern end of a bridge starting at a middle tile |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
118 |
*/ |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
119 |
TileIndex GetSouthernBridgeEnd(TileIndex t); |
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
120 |
|
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
121 |
|
655763f3861c
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
122 |
/** |
3214
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
123 |
* Starting at one bridge end finds the other bridge end |
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
124 |
*/ |
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
125 |
TileIndex GetOtherBridgeEnd(TileIndex); |
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
126 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
127 |
uint GetBridgeHeight(TileIndex tile); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
128 |
uint GetBridgeFoundation(Slope tileh, Axis axis); |
3214
172b409bf612
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
129 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
130 |
static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a) |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
131 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
132 |
assert(MayHaveBridgeAbove(t)); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
133 |
CLRBIT(_m[t].extra, 6 + a); |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
134 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
135 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
136 |
|
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
137 |
static inline void ClearBridgeMiddle(TileIndex t) |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
138 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
139 |
ClearSingleBridgeMiddle(t, AXIS_X); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
140 |
ClearSingleBridgeMiddle(t, AXIS_Y); |
3977
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
141 |
} |
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
142 |
|
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
143 |
static inline void SetBridgeMiddle(TileIndex t, Axis a) |
3977
edb5b94e2094
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
144 |
{ |
5573
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
145 |
assert(MayHaveBridgeAbove(t)); |
afa6f92a71fd
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
146 |
SETBIT(_m[t].extra, 6 + a); |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
147 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
148 |
|
3209
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
149 |
|
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
150 |
static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt) |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
151 |
{ |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
152 |
SetTileOwner(t, o); |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
153 |
_m[t].m2 = bridgetype << 4; |
5600
bac9ab186cab
(svn r7645) [cbh] - Fix: In r7643, I broke the building of new bridges because I forgot to change the map-accessors. repair this
celestar
parents:
5596
diff
changeset
|
154 |
_m[t].m4 = d << 5; |
bac9ab186cab
(svn r7645) [cbh] - Fix: In r7643, I broke the building of new bridges because I forgot to change the map-accessors. repair this
celestar
parents:
5596
diff
changeset
|
155 |
_m[t].m5 = 0; |
3209
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
156 |
} |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
157 |
|
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
158 |
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d) |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
159 |
{ |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
160 |
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD); |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
161 |
SetTileType(t, MP_STREET_BRIDGE); |
3209
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
162 |
_m[t].m3 = 0; |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
163 |
} |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
164 |
|
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
165 |
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r) |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
166 |
{ |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
167 |
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL); |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
5573
diff
changeset
|
168 |
SetTileType(t, MP_RAILWAY_BRIDGE); |
3209
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
169 |
_m[t].m3 = r; |
5600
bac9ab186cab
(svn r7645) [cbh] - Fix: In r7643, I broke the building of new bridges because I forgot to change the map-accessors. repair this
celestar
parents:
5596
diff
changeset
|
170 |
_m[t].m5 = DiagDirToAxis(d) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y; |
3209
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
171 |
} |
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
172 |
|
e0b7d48351a3
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
173 |
|
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
|
174 |
#endif /* BRIDGE_MAP_H */ |