equal
deleted
inserted
replaced
6 #include "openttd.h" |
6 #include "openttd.h" |
7 #include "bridge_map.h" |
7 #include "bridge_map.h" |
8 #include "bridge.h" |
8 #include "bridge.h" |
9 #include "variables.h" |
9 #include "variables.h" |
10 #include "landscape.h" |
10 #include "landscape.h" |
|
11 #include "tunnelbridge_map.h" |
11 |
12 |
12 |
13 |
13 TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir) |
14 TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir) |
14 { |
15 { |
15 TileIndexDiff delta = TileOffsByDiagDir(dir); |
16 TileIndexDiff delta = TileOffsByDiagDir(dir); |
16 |
17 |
17 dir = ReverseDiagDir(dir); |
18 dir = ReverseDiagDir(dir); |
18 do { |
19 do { |
19 tile += delta; |
20 tile += delta; |
20 } while (!IsBridgeTile(tile) || GetBridgeRampDirection(tile) != dir); |
21 } while (!IsBridgeTile(tile) || GetTunnelBridgeDirection(tile) != dir); |
21 |
22 |
22 return tile; |
23 return tile; |
23 } |
24 } |
24 |
25 |
25 |
26 |
36 |
37 |
37 |
38 |
38 TileIndex GetOtherBridgeEnd(TileIndex tile) |
39 TileIndex GetOtherBridgeEnd(TileIndex tile) |
39 { |
40 { |
40 assert(IsBridgeTile(tile)); |
41 assert(IsBridgeTile(tile)); |
41 return GetBridgeEnd(tile, GetBridgeRampDirection(tile)); |
42 return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile)); |
42 } |
43 } |
43 |
44 |
44 uint GetBridgeHeight(TileIndex t) |
45 uint GetBridgeHeight(TileIndex t) |
45 { |
46 { |
46 uint h; |
47 uint h; |
47 Slope tileh = GetTileSlope(t, &h); |
48 Slope tileh = GetTileSlope(t, &h); |
48 Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(t))); |
49 Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t))); |
49 |
50 |
50 /* one height level extra for the ramp */ |
51 /* one height level extra for the ramp */ |
51 return h + TILE_HEIGHT + ApplyFoundationToSlope(f, &tileh); |
52 return h + TILE_HEIGHT + ApplyFoundationToSlope(f, &tileh); |
52 } |
53 } |