Files
@ r7362:10cac61763f7
Branch filter:
Location: cpp/openttd-patchpack/source/src/bridge_map.cpp - annotation
r7362:10cac61763f7
1.1 KiB
text/x-c
(svn r10725) -Codechange: move some window related code out of gfx.cpp to windows.cpp
r5584:545d748cc681 r5584:545d748cc681 r6418:8a4b147a8f33 r6123:049e9624d068 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6418:8a4b147a8f33 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 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 r5587:034e5e185dc2 r7336:adf4f7c9574b r5584:545d748cc681 r6123:049e9624d068 r5584:545d748cc681 r5584:545d748cc681 r7336:adf4f7c9574b r5584:545d748cc681 r5584:545d748cc681 | /* $Id$ */
/** @file bridge_map.cpp Map accessor functions for bridges. */
#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
#include "bridge.h"
#include "variables.h"
TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
{
TileIndexDiff delta = TileOffsByDiagDir(dir);
dir = ReverseDiagDir(dir);
do {
tile += delta;
} while (!IsBridgeTile(tile) || GetBridgeRampDirection(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, GetBridgeRampDirection(tile));
}
uint GetBridgeHeight(TileIndex t)
{
uint h;
Slope tileh = GetTileSlope(t, &h);
Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(t)));
/* one height level extra if the ramp is on a flat foundation */
return
h + TILE_HEIGHT +
(IsLeveledFoundation(f) ? TILE_HEIGHT : 0) +
(IsSteepSlope(tileh) ? TILE_HEIGHT : 0);
}
|