author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9490 | 01c07bde5e84 |
permissions | -rw-r--r-- |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
2 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
3 |
/** @file bridge_map.h Map accessor functions for bridges. */ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5596
diff
changeset
|
4 |
|
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
5 |
#ifndef BRIDGE_MAP_H |
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
6 |
#define BRIDGE_MAP_H |
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
7 |
|
8100
6bc08f98ec16
(svn r11661) -Codechange: some header reworks in order to try to reduce the compile time of OpenTTD by reduce the amount of circular-ish dependencies.
rubidium
parents:
8083
diff
changeset
|
8 |
#include "direction_func.h" |
8103
cf92483a0abf
(svn r11664) -Codechange: use more specific ("rail_type.h" instead of "rail.h" that includes way more than only "rail_type.h") includes at some places.
rubidium
parents:
8100
diff
changeset
|
9 |
#include "rail_type.h" |
9126
5648d696456b
(svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium
parents:
8532
diff
changeset
|
10 |
#include "transport_type.h" |
3234
a2791a480b71
(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
|
11 |
#include "road_map.h" |
8532
ebe68d6899b6
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas
parents:
8139
diff
changeset
|
12 |
#include "bridge.h" |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
13 |
|
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
14 |
/** |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
15 |
* Checks if this is a bridge, instead of a tunnel |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
16 |
* @param t The tile to analyze |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
17 |
* @pre IsTileType(t, MP_TUNNELBRIDGE) |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
18 |
* @return true if the structure is a bridge one |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
19 |
*/ |
3234
a2791a480b71
(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
|
20 |
static inline bool IsBridge(TileIndex t) |
a2791a480b71
(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
|
21 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
22 |
assert(IsTileType(t, MP_TUNNELBRIDGE)); |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7370
diff
changeset
|
23 |
return HasBit(_m[t].m5, 7); |
3234
a2791a480b71
(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
|
24 |
} |
a2791a480b71
(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
|
25 |
|
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
26 |
/** |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
27 |
* checks if there is a bridge on this tile |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
28 |
* @param t The tile to analyze |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
29 |
* @return true if a bridge is present |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
30 |
*/ |
3234
a2791a480b71
(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
|
31 |
static inline bool IsBridgeTile(TileIndex t) |
a2791a480b71
(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 |
{ |
a2791a480b71
(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 |
return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t); |
a2791a480b71
(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
|
34 |
} |
a2791a480b71
(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
|
35 |
|
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
36 |
/** |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
37 |
* checks for the possibility that a bridge may be on this tile |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
38 |
* These are in fact all the tile types on which a bridge can be found |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
39 |
* @param t The tile to analyze |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
40 |
* @return true if a bridge migh be present |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
41 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
42 |
static inline bool MayHaveBridgeAbove(TileIndex t) |
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
43 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
44 |
return |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
45 |
IsTileType(t, MP_CLEAR) || |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
46 |
IsTileType(t, MP_RAILWAY) || |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6661
diff
changeset
|
47 |
IsTileType(t, MP_ROAD) || |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
48 |
IsTileType(t, MP_WATER) || |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
49 |
IsTileType(t, MP_TUNNELBRIDGE) || |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
50 |
IsTileType(t, MP_UNMOVABLE); |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
51 |
} |
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
52 |
|
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
53 |
/** |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
54 |
* checks if a bridge is set above the ground of this tile |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
55 |
* @param t The tile to analyze |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
56 |
* @pre MayHaveBridgeAbove(t) |
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
57 |
* @return true if a bridge is detected above |
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
58 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
59 |
static inline bool IsBridgeAbove(TileIndex t) |
3933 | 60 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
61 |
assert(MayHaveBridgeAbove(t)); |
5596
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5475
diff
changeset
|
62 |
return GB(_m[t].m6, 6, 2) != 0; |
3231
b85d451b6bf8
(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
|
63 |
} |
b85d451b6bf8
(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 |
|
b85d451b6bf8
(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 |
/** |
b85d451b6bf8
(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
|
66 |
* Determines the type of bridge on a tile |
6416
dc8d134b8c48
(svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas
parents:
6160
diff
changeset
|
67 |
* @param t The tile to analyze |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
68 |
* @pre IsBridgeTile(t) |
3231
b85d451b6bf8
(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
|
69 |
* @return The bridge type |
b85d451b6bf8
(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
|
70 |
*/ |
8532
ebe68d6899b6
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas
parents:
8139
diff
changeset
|
71 |
static inline BridgeType GetBridgeType(TileIndex t) |
3231
b85d451b6bf8
(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
|
72 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
73 |
assert(IsBridgeTile(t)); |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3355
diff
changeset
|
74 |
return GB(_m[t].m2, 4, 4); |
3231
b85d451b6bf8
(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
|
75 |
} |
b85d451b6bf8
(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
|
76 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
77 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
78 |
* Get the axis of the bridge that goes over the tile. Not the axis or the ramp. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
79 |
* @param t The tile to analyze |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
80 |
* @pre IsBridgeAbove(t) |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
81 |
* @return the above mentioned axis |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
82 |
*/ |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
83 |
static inline Axis GetBridgeAxis(TileIndex t) |
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
84 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
85 |
assert(IsBridgeAbove(t)); |
5596
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5475
diff
changeset
|
86 |
return (Axis)(GB(_m[t].m6, 6, 2) - 1); |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
87 |
} |
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
88 |
|
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
89 |
/** |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
90 |
* Finds the end of a bridge in the specified direction starting at a middle tile |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
91 |
* @param t the bridge tile to find the bridge ramp for |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
92 |
* @param d the direction to search in |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
93 |
*/ |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
94 |
TileIndex GetBridgeEnd(TileIndex t, DiagDirection d); |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
95 |
|
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
96 |
/** |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
97 |
* Finds the northern end of a bridge starting at a middle tile |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
98 |
* @param t the bridge tile to find the bridge ramp for |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
99 |
*/ |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
100 |
TileIndex GetNorthernBridgeEnd(TileIndex t); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
101 |
|
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
102 |
/** |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
103 |
* Finds the southern end of a bridge starting at a middle tile |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
104 |
* @param t the bridge tile to find the bridge ramp for |
3225
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
105 |
*/ |
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
106 |
TileIndex GetSouthernBridgeEnd(TileIndex t); |
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
107 |
|
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
108 |
|
3a3e35bd39a6
(svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents:
3216
diff
changeset
|
109 |
/** |
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
110 |
* Starting at one bridge end finds the other bridge end |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
111 |
* @param t the bridge ramp tile to find the other bridge ramp for |
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
112 |
*/ |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
113 |
TileIndex GetOtherBridgeEnd(TileIndex t); |
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
114 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
115 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
116 |
* Get the height ('z') of a bridge in pixels. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
117 |
* @param tile the bridge ramp tile to get the bridge height from |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
118 |
* @return the height of the bridge in pixels |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
119 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
120 |
uint GetBridgeHeight(TileIndex tile); |
3214
dd744119dfac
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents:
3209
diff
changeset
|
121 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
122 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
123 |
* Remove the bridge over the given axis. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
124 |
* @param t the tile to remove the bridge from |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
125 |
* @param a the axis of the bridge to remove |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
126 |
* @pre MayHaveBridgeAbove(t) |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
127 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
128 |
static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a) |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
129 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
130 |
assert(MayHaveBridgeAbove(t)); |
7929
6c9b25842b0f
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13
parents:
7928
diff
changeset
|
131 |
ClrBit(_m[t].m6, 6 + a); |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
132 |
} |
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
133 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
134 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
135 |
* Removes bridges from the given, that is bridges along the X and Y axis. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
136 |
* @param t the tile to remove the bridge from |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
137 |
* @pre MayHaveBridgeAbove(t) |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
138 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
139 |
static inline void ClearBridgeMiddle(TileIndex t) |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
140 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
141 |
ClearSingleBridgeMiddle(t, AXIS_X); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
142 |
ClearSingleBridgeMiddle(t, AXIS_Y); |
3977
513433ebd092
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
143 |
} |
513433ebd092
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
144 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
145 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
146 |
* Set that there is a bridge over the given axis. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
147 |
* @param t the tile to add the bridge to |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
148 |
* @param a the axis of the bridge to add |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
149 |
* @pre MayHaveBridgeAbove(t) |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
150 |
*/ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
151 |
static inline void SetBridgeMiddle(TileIndex t, Axis a) |
3977
513433ebd092
(svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents:
3953
diff
changeset
|
152 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
153 |
assert(MayHaveBridgeAbove(t)); |
7931
b0a46cd92225
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13
parents:
7929
diff
changeset
|
154 |
SetBit(_m[t].m6, 6 + a); |
3189
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
155 |
} |
bf047128dee7
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
156 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
157 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
158 |
* Generic part to make a bridge ramp for both roads and rails. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
159 |
* @param t the tile to make a bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
160 |
* @param o the new owner of the bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
161 |
* @param bridgetype the type of bridge this bridge ramp belongs to |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
162 |
* @param d the direction this ramp must be facing |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
163 |
* @param tt the transport type of the bridge |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
164 |
* @param rt the road or rail type |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
165 |
* @note this function should not be called directly. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
166 |
*/ |
8532
ebe68d6899b6
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas
parents:
8139
diff
changeset
|
167 |
static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt, uint rt) |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
168 |
{ |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
169 |
SetTileType(t, MP_TUNNELBRIDGE); |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
170 |
SetTileOwner(t, o); |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
171 |
_m[t].m2 = bridgetype << 4; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
172 |
_m[t].m3 = rt; |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
173 |
_m[t].m4 = 0; |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4666
diff
changeset
|
174 |
_m[t].m5 = 1 << 7 | tt << 2 | d; |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
175 |
} |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
176 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
177 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
178 |
* Make a bridge ramp for roads. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
179 |
* @param t the tile to make a bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
180 |
* @param o the new owner of the bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
181 |
* @param bridgetype the type of bridge this bridge ramp belongs to |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
182 |
* @param d the direction this ramp must be facing |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
183 |
* @param r the road type of the bridge |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
184 |
*/ |
8532
ebe68d6899b6
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas
parents:
8139
diff
changeset
|
185 |
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RoadTypes r) |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
186 |
{ |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
187 |
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r); |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
188 |
} |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
189 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
190 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
191 |
* Make a bridge ramp for rails. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
192 |
* @param t the tile to make a bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
193 |
* @param o the new owner of the bridge ramp |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
194 |
* @param bridgetype the type of bridge this bridge ramp belongs to |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
195 |
* @param d the direction this ramp must be facing |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
196 |
* @param r the rail type of the bridge |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6416
diff
changeset
|
197 |
*/ |
8532
ebe68d6899b6
(svn r12107) -Codechange: Add and use the typedef BridgeType
belugas
parents:
8139
diff
changeset
|
198 |
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType r) |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
199 |
{ |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
200 |
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r); |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
201 |
} |
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
202 |
|
9490
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
203 |
/** |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
204 |
* Make a bridge ramp for aqueducts. |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
205 |
* @param t the tile to make a bridge ramp |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
206 |
* @param o the new owner of the bridge ramp |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
207 |
* @param d the direction this ramp must be facing |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
208 |
*/ |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
209 |
static inline void MakeAqueductBridgeRamp(TileIndex t, Owner o, DiagDirection d) |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
210 |
{ |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
211 |
MakeBridgeRamp(t, o, 0, d, TRANSPORT_WATER, 0); |
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9126
diff
changeset
|
212 |
} |
3209
98153d2f1ba7
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents:
3196
diff
changeset
|
213 |
|
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4158
diff
changeset
|
214 |
#endif /* BRIDGE_MAP_H */ |