blob: 758ba59a56dfa25588955f393701a0c1606d247c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* $Id$ */
/** @file tunnelbridge.h Header file for things common for tunnels and bridges */
#ifndef TUNNELBRIDGE_H
#define TUNNELBRIDGE_H
#include "tile_type.h"
#include "map_func.h"
#include "tunnelbridge_map.h"
/**
* Calculates the length of a tunnel or a bridge (without end tiles)
* @return length of bridge/tunnel middle
*/
static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
{
int x1 = TileX(begin);
int y1 = TileY(begin);
int x2 = TileX(end);
int y2 = TileY(end);
return abs(x2 + y2 - x1 - y1) - 1;
}
#endif /* TUNNELBRIDGE_H */
|