2006-03-15 16:44:50 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "openttd.h"
|
|
|
|
#include "bridge_map.h"
|
|
|
|
|
|
|
|
|
2006-03-16 05:28:15 +00:00
|
|
|
TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
|
|
|
|
{
|
|
|
|
TileIndexDiff delta = TileOffsByDir(dir);
|
|
|
|
|
|
|
|
assert(DiagDirToAxis(dir) == GetBridgeAxis(tile));
|
|
|
|
|
|
|
|
do {
|
|
|
|
tile += delta;
|
|
|
|
} while (!IsBridgeRamp(tile));
|
|
|
|
|
|
|
|
return tile;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TileIndex GetSouthernBridgeEnd(TileIndex t)
|
|
|
|
{
|
|
|
|
return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-15 16:44:50 +00:00
|
|
|
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
|
|
|
{
|
|
|
|
TileIndexDiff delta = TileOffsByDir(GetBridgeRampDirection(tile));
|
|
|
|
|
|
|
|
do {
|
|
|
|
tile += delta;
|
|
|
|
} while (!IsBridgeRamp(tile));
|
|
|
|
|
|
|
|
return tile;
|
|
|
|
}
|