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/>.
8 /** @file tunnelbridge.h Header file for things common for tunnels and bridges */
10 #ifndef TUNNELBRIDGE_H
11 #define TUNNELBRIDGE_H
16 void MarkBridgeDirty(TileIndex begin
, TileIndex end
, DiagDirection direction
, uint bridge_height
);
17 void MarkBridgeDirty(TileIndex tile
);
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 inline uint
GetTunnelBridgeLength(TileIndex begin
, TileIndex end
)
27 int x1
= TileX(begin
);
28 int y1
= TileY(begin
);
32 return abs(x2
+ y2
- x1
- y1
) - 1;
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 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 */