From 1721a397fcd6676fb4e0b7aff2a23bac54def6ae Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Tue, 15 May 2018 01:01:19 +0200 Subject: [PATCH] Fix drawing edges for surfaces with water --- src/openrct2/paint/tile_element/Surface.cpp | 29 ++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/openrct2/paint/tile_element/Surface.cpp b/src/openrct2/paint/tile_element/Surface.cpp index e05db91508..cbe9d3021e 100644 --- a/src/openrct2/paint/tile_element/Surface.cpp +++ b/src/openrct2/paint/tile_element/Surface.cpp @@ -677,27 +677,26 @@ static void viewport_surface_draw_tile_side_bottom(paint_session * session, enum return; } - // TODO: Check the viewport flag for view clipping instead of calling `tile_is_inside_clip_view(self)` - if (neighbour.tile_element == nullptr || (tile_is_inside_clip_view(self) && !tile_is_inside_clip_view(neighbour))) + bool neighbourIsClippedAway = (gCurrentViewportFlags & VIEWPORT_FLAG_CLIP_VIEW) && !tile_is_inside_clip_view(neighbour); + + if (neighbour.tile_element == nullptr || neighbourIsClippedAway) { - // The neigbour tile doesn't exist or isn't drawn - assume minimum height to draw full edges + // The neighbour tile doesn't exist or isn't drawn - assume minimum height to draw full edges neighbourCornerHeight2 = MINIMUM_LAND_HEIGHT / 2; neighbourCornerHeight1 = MINIMUM_LAND_HEIGHT / 2; } - else - { - if (isWater) - { - uint8 waterHeight = surface_get_water_height(neighbour.tile_element); - if (waterHeight == height) - { - // Don't draw the edge when the neighbour's water level is the same - return; - } - cornerHeight1 = height; - cornerHeight2 = height; + if (isWater) + { + uint8 waterHeight = surface_get_water_height(neighbour.tile_element); + if (waterHeight == height && !neighbourIsClippedAway) + { + // Don't draw the edge when the neighbour's water level is the same + return; } + + cornerHeight1 = height; + cornerHeight2 = height; } if (cornerHeight1 <= neighbourCornerHeight1 && cornerHeight2 <= neighbourCornerHeight2)