author | truebrain |
Thu, 12 Jun 2008 19:47:02 +0000 | |
branch | noai |
changeset 10942 | cd3f2d07199f |
parent 10249 | 58810805030e |
permissions | -rw-r--r-- |
9724 | 1 |
/* $Id$ */ |
2 |
||
3 |
/** @file tunnelbridge.h Header file for things common for tunnels and bridges */ |
|
4 |
||
5 |
#ifndef TUNNELBRIDGE_H |
|
6 |
#define TUNNELBRIDGE_H |
|
7 |
||
8 |
#include "tile_type.h" |
|
9 |
||
10 |
/** |
|
11 |
* Calculates the length of a tunnel or a bridge (without end tiles) |
|
12 |
* @return length of bridge/tunnel middle |
|
13 |
*/ |
|
14 |
static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end) |
|
15 |
{ |
|
16 |
int x1 = TileX(begin); |
|
17 |
int y1 = TileY(begin); |
|
18 |
int x2 = TileX(end); |
|
19 |
int y2 = TileY(end); |
|
20 |
||
21 |
return abs(x2 + y2 - x1 - y1) - 1; |
|
22 |
} |
|
23 |
||
10249
58810805030e
(svn r12781) [NoAI] -Sync: with trunk r12711:12780.
rubidium
parents:
9724
diff
changeset
|
24 |
extern TileIndex _build_tunnel_endtile; |
58810805030e
(svn r12781) [NoAI] -Sync: with trunk r12711:12780.
rubidium
parents:
9724
diff
changeset
|
25 |
|
9724 | 26 |
#endif /* TUNNELBRIDGE_H */ |