annotate src/bridge_map.h @ 9038:6e86ab2cba9f draft

(svn r12857) -Fix [FS#1948]: remove the last uses of AutoPtr in the station code.
author rubidium <rubidium@openttd.org>
date Wed, 23 Apr 2008 22:16:41 +0000
parents b3bd4f1ed981
children 8c450e1754e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
3 /** @file bridge_map.h Map accessor functions for bridges. */
6123
595dc16a6fd8 (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents: 5596
diff changeset
4
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #ifndef BRIDGE_MAP_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #define BRIDGE_MAP_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
7
8100
6d739a5490a9 (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 <rubidium@openttd.org>
parents: 8083
diff changeset
8 #include "direction_func.h"
8103
1721819ad261 (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 <rubidium@openttd.org>
parents: 8100
diff changeset
9 #include "rail_type.h"
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 #include "road_map.h"
8532
b3bd4f1ed981 (svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents: 8139
diff changeset
11 #include "bridge.h"
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
12
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
13
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
14 /**
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
15 * Checks if this is a bridge, instead of a tunnel
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
16 * @param t The tile to analyze
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
17 * @pre IsTileType(t, MP_TUNNELBRIDGE)
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
18 * @return true if the structure is a bridge one
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
19 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 static inline bool IsBridge(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
21 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
22 assert(IsTileType(t, MP_TUNNELBRIDGE));
7928
4e8dfd103163 (svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7370
diff changeset
23 return HasBit(_m[t].m5, 7);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
25
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
26 /**
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
27 * checks if there is a bridge on this tile
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
28 * @param t The tile to analyze
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
29 * @return true if a bridge is present
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
30 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 static inline bool IsBridgeTile(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
34 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
35
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
36 /**
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
37 * checks for the possibility that a bridge may be on this tile
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
38 * These are in fact all the tile types on which a bridge can be found
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
39 * @param t The tile to analyze
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
40 * @return true if a bridge migh be present
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
41 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
42 static inline bool MayHaveBridgeAbove(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
43 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
44 return
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
45 IsTileType(t, MP_CLEAR) ||
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
46 IsTileType(t, MP_RAILWAY) ||
7370
fba35a9abf79 (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
47 IsTileType(t, MP_ROAD) ||
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
48 IsTileType(t, MP_WATER) ||
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
49 IsTileType(t, MP_TUNNELBRIDGE) ||
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
50 IsTileType(t, MP_UNMOVABLE);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
51 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
52
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
53 /**
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
54 * checks if a bridge is set above the ground of this tile
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
55 * @param t The tile to analyze
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
56 * @pre MayHaveBridgeAbove(t)
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
57 * @return true if a bridge is detected above
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
58 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
59 static inline bool IsBridgeAbove(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
60 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
61 assert(MayHaveBridgeAbove(t));
5596
e7de87a06a18 (svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas <belugas@openttd.org>
parents: 5475
diff changeset
62 return GB(_m[t].m6, 6, 2) != 0;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
63 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
64
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
65 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
66 * Determines the type of bridge on a tile
6416
0c8df93f48c9 (svn r9552) -Documentation: Some more doxygen work, adding comments too
belugas <belugas@openttd.org>
parents: 6160
diff changeset
67 * @param t The tile to analyze
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
68 * @pre IsBridgeTile(t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 * @return The bridge type
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
70 */
8532
b3bd4f1ed981 (svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents: 8139
diff changeset
71 static inline BridgeType GetBridgeType(TileIndex t)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
72 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
73 assert(IsBridgeTile(t));
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
74 return GB(_m[t].m2, 4, 4);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
75 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
76
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
77 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
78 * Get the axis of the bridge that goes over the tile. Not the axis or the ramp.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
79 * @param t The tile to analyze
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
80 * @pre IsBridgeAbove(t)
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
81 * @return the above mentioned axis
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
82 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
83 static inline Axis GetBridgeAxis(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
84 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
85 assert(IsBridgeAbove(t));
5596
e7de87a06a18 (svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas <belugas@openttd.org>
parents: 5475
diff changeset
86 return (Axis)(GB(_m[t].m6, 6, 2) - 1);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
87 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
88
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
89 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
90 * Finds the end of a bridge in the specified direction starting at a middle tile
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
91 * @param t the bridge tile to find the bridge ramp for
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
92 * @param d the direction to search in
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
93 */
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
94 TileIndex GetBridgeEnd(TileIndex t, DiagDirection d);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
95
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
96 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
97 * Finds the northern end of a bridge starting at a middle tile
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
98 * @param t the bridge tile to find the bridge ramp for
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
99 */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
100 TileIndex GetNorthernBridgeEnd(TileIndex t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
101
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
102 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
103 * Finds the southern end of a bridge starting at a middle tile
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
104 * @param t the bridge tile to find the bridge ramp for
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
105 */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
106 TileIndex GetSouthernBridgeEnd(TileIndex t);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
107
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
108
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
109 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
110 * Starting at one bridge end finds the other bridge end
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
111 * @param t the bridge ramp tile to find the other bridge ramp for
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
112 */
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
113 TileIndex GetOtherBridgeEnd(TileIndex t);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
114
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
115 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
116 * Get the height ('z') of a bridge in pixels.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
117 * @param tile the bridge ramp tile to get the bridge height from
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
118 * @return the height of the bridge in pixels
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
119 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
120 uint GetBridgeHeight(TileIndex tile);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
121
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
122 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
123 * Remove the bridge over the given axis.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
124 * @param t the tile to remove the bridge from
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
125 * @param a the axis of the bridge to remove
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
126 * @pre MayHaveBridgeAbove(t)
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
127 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
128 static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
129 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
130 assert(MayHaveBridgeAbove(t));
7929
4d13dbed828c (svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7928
diff changeset
131 ClrBit(_m[t].m6, 6 + a);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
132 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
133
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
134 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
135 * Removes bridges from the given, that is bridges along the X and Y axis.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
136 * @param t the tile to remove the bridge from
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
137 * @pre MayHaveBridgeAbove(t)
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
138 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
139 static inline void ClearBridgeMiddle(TileIndex t)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
140 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
141 ClearSingleBridgeMiddle(t, AXIS_X);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
142 ClearSingleBridgeMiddle(t, AXIS_Y);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
143 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
144
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
145 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
146 * Set that there is a bridge over the given axis.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
147 * @param t the tile to add the bridge to
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
148 * @param a the axis of the bridge to add
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
149 * @pre MayHaveBridgeAbove(t)
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
150 */
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
151 static inline void SetBridgeMiddle(TileIndex t, Axis a)
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
152 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
153 assert(MayHaveBridgeAbove(t));
7931
44ff7a6d801f (svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7929
diff changeset
154 SetBit(_m[t].m6, 6 + a);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
155 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
156
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
157 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
158 * Generic part to make a bridge ramp for both roads and rails.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
159 * @param t the tile to make a bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
160 * @param o the new owner of the bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
161 * @param bridgetype the type of bridge this bridge ramp belongs to
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
162 * @param d the direction this ramp must be facing
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
163 * @param tt the transport type of the bridge
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6418
diff changeset
164 * @param rt the road or rail type
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
165 * @note this function should not be called directly.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
166 */
8532
b3bd4f1ed981 (svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents: 8139
diff changeset
167 static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt, uint rt)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
168 {
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
169 SetTileType(t, MP_TUNNELBRIDGE);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
170 SetTileOwner(t, o);
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
171 _m[t].m2 = bridgetype << 4;
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6418
diff changeset
172 _m[t].m3 = rt;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
173 _m[t].m4 = 0;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
174 _m[t].m5 = 1 << 7 | tt << 2 | d;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
175 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
176
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
177 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
178 * Make a bridge ramp for roads.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
179 * @param t the tile to make a bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
180 * @param o the new owner of the bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
181 * @param bridgetype the type of bridge this bridge ramp belongs to
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
182 * @param d the direction this ramp must be facing
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6418
diff changeset
183 * @param r the road type of the bridge
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
184 */
8532
b3bd4f1ed981 (svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents: 8139
diff changeset
185 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RoadTypes r)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
186 {
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6418
diff changeset
187 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
188 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
189
6418
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
190 /**
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
191 * Make a bridge ramp for rails.
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
192 * @param t the tile to make a bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
193 * @param o the new owner of the bridge ramp
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
194 * @param bridgetype the type of bridge this bridge ramp belongs to
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
195 * @param d the direction this ramp must be facing
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
196 * @param r the rail type of the bridge
c8862595d06b (svn r9554) -Documentation: add documentation to some map accessors.
rubidium <rubidium@openttd.org>
parents: 6416
diff changeset
197 */
8532
b3bd4f1ed981 (svn r12107) -Codechange: Add and use the typedef BridgeType
belugas <belugas@openttd.org>
parents: 8139
diff changeset
198 static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType r)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
199 {
6661
5850ac8865e8 (svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium <rubidium@openttd.org>
parents: 6418
diff changeset
200 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
201 }
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
202
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
203
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
204 #endif /* BRIDGE_MAP_H */