summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-24 22:52:24 +0000
committertron <tron@openttd.org>2006-06-24 22:52:24 +0000
commit20ee056b9ffb2277021c5c5e09fdd8b460823175 (patch)
tree9cba03d8e1d496e368c397423b43774522f16f5b /tunnelbridge_cmd.c
parent7f444dde30d4c9ed111266d9203f858a02b8e329 (diff)
downloadopenttd-20ee056b9ffb2277021c5c5e09fdd8b460823175.tar.xz
(svn r5352) -Fix: Return accurate slope information for tunnels and bridges to fix several foundation graphics glitches
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index b6034db69..b93fd9ed0 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1146,8 +1146,29 @@ static uint GetSlopeZ_TunnelBridge(const TileInfo* ti)
static Slope GetSlopeTileh_TunnelBridge(TileIndex tile, Slope tileh)
{
- // not accurate, but good enough for slope graphics drawing
- return SLOPE_FLAT;
+ uint f;
+
+ if (IsTunnel(tile)) {
+ return tileh;
+ } else {
+ if (IsBridgeRamp(tile)) {
+ if (HASBIT(BRIDGE_NO_FOUNDATION, tileh)) {
+ return tileh;
+ } else {
+ f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(tile)));
+ }
+ } else {
+ if (IsTransportUnderBridge(tile)) {
+ f = _bridge_foundations[GetBridgeAxis(tile)][tileh];
+ } else {
+ return tileh;
+ }
+ }
+ }
+
+ if (f == 0) return tileh;
+ if (f < 15) return SLOPE_FLAT;
+ return _inclined_tileh[f - 15];
}