Files
@ r15326:d5a6f99c5425
Branch filter:
Location: cpp/openttd-patchpack/source/src/bridge_map.cpp - annotation
r15326:d5a6f99c5425
1.8 KiB
text/x-c
(svn r19977) -Add: Read current date during SL_LOAD_CHECK.
r5584:545d748cc681 r5584:545d748cc681 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r6418:8a4b147a8f33 r6123:049e9624d068 r5584:545d748cc681 r7764:ffc843cdbcf7 r8083:8cd2123a0c7c r5584:545d748cc681 r5584:545d748cc681 r13499:0af2aac7f5aa r13499:0af2aac7f5aa r13527:21498da4c6d5 r13527:21498da4c6d5 r13499:0af2aac7f5aa r13499:0af2aac7f5aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8083:8cd2123a0c7c r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8083:8cd2123a0c7c r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5587:034e5e185dc2 r8083:8cd2123a0c7c r5584:545d748cc681 r7764:ffc843cdbcf7 r7764:ffc843cdbcf7 r5584:545d748cc681 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file bridge_map.cpp Map accessor functions for bridges. */
#include "stdafx.h"
#include "landscape.h"
#include "tunnelbridge_map.h"
/**
* Finds the end of a bridge in the specified direction starting at a middle tile
* @param tile the bridge tile to find the bridge ramp for
* @param dir the direction to search in
*/
static TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
{
TileIndexDiff delta = TileOffsByDiagDir(dir);
dir = ReverseDiagDir(dir);
do {
tile += delta;
} while (!IsBridgeTile(tile) || GetTunnelBridgeDirection(tile) != dir);
return tile;
}
TileIndex GetNorthernBridgeEnd(TileIndex t)
{
return GetBridgeEnd(t, ReverseDiagDir(AxisToDiagDir(GetBridgeAxis(t))));
}
TileIndex GetSouthernBridgeEnd(TileIndex t)
{
return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
}
TileIndex GetOtherBridgeEnd(TileIndex tile)
{
assert(IsBridgeTile(tile));
return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile));
}
uint GetBridgeHeight(TileIndex t)
{
uint h;
Slope tileh = GetTileSlope(t, &h);
Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t)));
/* one height level extra for the ramp */
return h + TILE_HEIGHT + ApplyFoundationToSlope(f, &tileh);
}
|