OpenTTD
bridge_map.cpp
Go to the documentation of this file.
1 /* $Id: bridge_map.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #include "stdafx.h"
13 #include "landscape.h"
14 #include "tunnelbridge_map.h"
15 
16 #include "safeguards.h"
17 
18 
25 {
26  TileIndexDiff delta = TileOffsByDiagDir(dir);
27 
28  dir = ReverseDiagDir(dir);
29  do {
30  tile += delta;
31  } while (!IsBridgeTile(tile) || GetTunnelBridgeDirection(tile) != dir);
32 
33  return tile;
34 }
35 
36 
42 {
44 }
45 
46 
52 {
54 }
55 
56 
62 {
63  assert(IsBridgeTile(tile));
64  return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile));
65 }
66 
73 {
74  int h;
75  Slope tileh = GetTileSlope(t, &h);
77 
78  /* one height level extra for the ramp */
79  return h + 1 + ApplyFoundationToSlope(f, &tileh);
80 }