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)
|
|
|
|
{
|
2006-09-05 23:21:41 +00:00
|
|
|
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
2006-03-16 05:28:15 +00:00
|
|
|
|
2006-06-07 19:35:21 +00:00
|
|
|
assert(DiagDirToAxis(dir) == GetBridgeAxis(tile));
|
2006-03-16 05:28:15 +00:00
|
|
|
|
2006-06-07 19:35:21 +00:00
|
|
|
do {
|
|
|
|
tile += delta;
|
|
|
|
} while (!IsBridgeRamp(tile));
|
2006-03-16 05:28:15 +00:00
|
|
|
|
2006-06-07 19:35:21 +00:00
|
|
|
return tile;
|
2006-06-02 13:05:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-16 05:28:15 +00:00
|
|
|
TileIndex GetSouthernBridgeEnd(TileIndex t)
|
|
|
|
{
|
|
|
|
return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-15 16:44:50 +00:00
|
|
|
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
|
|
|
{
|
2006-09-05 23:21:41 +00:00
|
|
|
TileIndexDiff delta = TileOffsByDiagDir(GetBridgeRampDirection(tile));
|
2006-03-15 16:44:50 +00:00
|
|
|
|
2006-06-07 19:35:21 +00:00
|
|
|
do {
|
|
|
|
tile += delta;
|
|
|
|
} while (!IsBridgeRamp(tile));
|
2006-06-02 13:05:41 +00:00
|
|
|
|
2006-06-07 19:35:21 +00:00
|
|
|
return tile;
|
2006-03-15 16:44:50 +00:00
|
|
|
}
|