Add: INR currency (#8136)
[openttd-github.git] / src / tunnelbridge.h
blob1e35f891cffc3d95e017b70de5b1dab47f073088
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
8 /** @file tunnelbridge.h Header file for things common for tunnels and bridges */
10 #ifndef TUNNELBRIDGE_H
11 #define TUNNELBRIDGE_H
13 #include "map_func.h"
14 #include "tile_map.h"
16 void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height);
17 void MarkBridgeDirty(TileIndex tile);
19 /**
20 * Calculates the length of a tunnel or a bridge (without end tiles)
21 * @param begin The begin of the tunnel or bridge.
22 * @param end The end of the tunnel or bridge.
23 * @return length of bridge/tunnel middle
25 static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
27 int x1 = TileX(begin);
28 int y1 = TileY(begin);
29 int x2 = TileX(end);
30 int y2 = TileY(end);
32 return abs(x2 + y2 - x1 - y1) - 1;
35 /**
36 * Sets the ownership of the bridge/tunnel ramps
37 * @param begin The begin of the tunnel or bridge.
38 * @param end The end of the tunnel or bridge.
39 * @param owner The new owner to set
41 static inline void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
43 SetTileOwner(begin, owner);
44 SetTileOwner(end, owner);
47 extern TileIndex _build_tunnel_endtile;
49 #endif /* TUNNELBRIDGE_H */