mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
7e4d0f112e
DiagDirections, and add TileOffsByDir that handles Directions. -Codechange: Make the treeloop use TileOffsByDir().
38 lines
613 B
C
38 lines
613 B
C
/* $Id$ */
|
|
|
|
#include "stdafx.h"
|
|
#include "openttd.h"
|
|
#include "bridge_map.h"
|
|
|
|
|
|
TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
|
|
{
|
|
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
|
|
|
assert(DiagDirToAxis(dir) == GetBridgeAxis(tile));
|
|
|
|
do {
|
|
tile += delta;
|
|
} while (!IsBridgeRamp(tile));
|
|
|
|
return tile;
|
|
}
|
|
|
|
|
|
TileIndex GetSouthernBridgeEnd(TileIndex t)
|
|
{
|
|
return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
|
|
}
|
|
|
|
|
|
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
|
{
|
|
TileIndexDiff delta = TileOffsByDiagDir(GetBridgeRampDirection(tile));
|
|
|
|
do {
|
|
tile += delta;
|
|
} while (!IsBridgeRamp(tile));
|
|
|
|
return tile;
|
|
}
|