(svn r27950) -Merge: Documentation updates from 1.7 branch
[openttd.git] / src / tunnelbridge.h
blob0a2c2293d5d1ee95efa51c2ebd5965e5d9e5635b
1 /* $Id$ */
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 */
10 /** @file tunnelbridge.h Header file for things common for tunnels and bridges */
12 #ifndef TUNNELBRIDGE_H
13 #define TUNNELBRIDGE_H
15 #include "map_func.h"
17 void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height);
18 void MarkBridgeDirty(TileIndex tile);
20 /**
21 * Calculates the length of a tunnel or a bridge (without end tiles)
22 * @param begin The begin of the tunnel or bridge.
23 * @param end The end of the tunnel or bridge.
24 * @return length of bridge/tunnel middle
26 static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
28 int x1 = TileX(begin);
29 int y1 = TileY(begin);
30 int x2 = TileX(end);
31 int y2 = TileY(end);
33 return abs(x2 + y2 - x1 - y1) - 1;
36 extern TileIndex _build_tunnel_endtile;
38 #endif /* TUNNELBRIDGE_H */