Chunnel patch 28393: Codechange: Rework GetOtherTunnelEnd proc.

https://www.tt-forums.net/viewtopic.php?p=1183416#p1183416
This commit is contained in:
HackaLittleBit
2017-03-04 11:44:22 +00:00
committed by Jonathan G Rennison
parent ad070b91ea
commit 67e7d12eb7
2 changed files with 46 additions and 15 deletions

View File

@@ -36,20 +36,8 @@ Tunnel::~Tunnel()
*/
TileIndex GetOtherTunnelEnd(TileIndex tile)
{
DiagDirection dir = GetTunnelBridgeDirection(tile);
TileIndexDiff delta = TileOffsByDiagDir(dir);
int z = GetTileZ(tile);
dir = ReverseDiagDir(dir);
do {
tile += delta;
} while (
!IsTunnelTile(tile) ||
GetTunnelBridgeDirection(tile) != dir ||
GetTileZ(tile) != z
);
return tile;
Tunnel *t = Tunnel::GetByTile(tile);
return t->tile_n == tile ? t->tile_s : t->tile_n;
}