src/tunnelbridge.h
author bjarni
Thu, 31 Jul 2008 13:44:57 +0000
changeset 9756 acd40bb24510
parent 8973 749e572f9378
permissions -rw-r--r--
(svn r13892) -Fix (r13863): [configure] now the SDK selection for OSX sets the default value as intended
/* $Id$ */

/** @file tunnelbridge.h Header file for things common for tunnels and bridges */

#ifndef TUNNELBRIDGE_H
#define TUNNELBRIDGE_H

#include "tile_type.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;
}

extern TileIndex _build_tunnel_endtile;

#endif /* TUNNELBRIDGE_H */