summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 1e35978af..5d8f2b8f3 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -229,7 +229,8 @@ static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
* Also note that the result of GetSlopePixelZ() is very special on bridge-ramps.
*/
- int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
+ int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + std::min<int8>(x_pcp_offsets[PCPpos], TILE_SIZE - 1),
+ TileY(tile) * TILE_SIZE + std::min<int8>(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2);
}