smatz@8894: /* $Id$ */ smatz@8894: smatz@8894: /** @file tunnelbridge.h Header file for things common for tunnels and bridges */ smatz@8894: smatz@8894: #ifndef TUNNELBRIDGE_H smatz@8894: #define TUNNELBRIDGE_H smatz@8894: smatz@8894: #include "tile_type.h" smatz@8894: #include "map_func.h" smatz@8894: #include "tunnelbridge_map.h" smatz@8894: smatz@8894: /** smatz@8894: * Calculates the length of a tunnel or a bridge (without end tiles) smatz@8894: * @return length of bridge/tunnel middle smatz@8894: */ smatz@8894: static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end) smatz@8894: { smatz@8894: int x1 = TileX(begin); smatz@8894: int y1 = TileY(begin); smatz@8894: int x2 = TileX(end); smatz@8894: int y2 = TileY(end); smatz@8894: smatz@8894: return abs(x2 + y2 - x1 - y1) - 1; smatz@8894: } smatz@8894: smatz@8894: #endif /* TUNNELBRIDGE_H */