From 279a056125ad037ce451734f04e045f70e4e585f Mon Sep 17 00:00:00 2001 From: Matthias Moninger <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:05:53 +0300 Subject: [PATCH] Fix #20543: Crash using show segments height from debug paint option. (#20561) * Fix #20543: Crash using show segments height debug option * Update changelog.txt --- distribution/changelog.txt | 1 + src/openrct2/paint/tile_element/Paint.TileElement.cpp | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 986103aa47..778940a7f2 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -29,6 +29,7 @@ - Fix: [#20429] Error window tooltip not closing after 8 seconds. - Fix: [#20456] Downward large half loops on flying coasters (fly-to-lie) are now correctly named. - Fix: [#20484] Console caret not properly updated when using command history. +- Fix: [#20543] Crash using show segments height from debug paint options. 0.4.5 (2023-05-08) ------------------------------------------------------------------------ diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index 51deeba9a8..e09d396f0f 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -314,7 +314,7 @@ static void PaintTileElementBase(PaintSession& session, const CoordsXY& origCoor for (std::size_t sx = 0; sx < std::size(segmentPositions[sy]); sx++) { uint16_t segmentHeight = session.SupportSegments[segmentPositions[sy][sx]].height; - auto imageColourFlats = ImageId(SPR_LAND_TOOL_SIZE_1).WithTransparency(FilterPaletteID::PaletteDarken3); + auto imageColourFlats = ImageId(SPR_LAND_TOOL_SIZE_1).WithTransparency(FilterPaletteID::PaletteGlassBlack); if (segmentHeight == 0xFFFF) { segmentHeight = session.Support.height; @@ -329,13 +329,9 @@ static void PaintTileElementBase(PaintSession& session, const CoordsXY& origCoor int32_t xOffset = static_cast(sy) * 10; int32_t yOffset = -22 + static_cast(sx) * 10; - PaintStruct* ps = PaintAddImageAsParent( + PaintAddImageAsParent( session, imageColourFlats, { xOffset, yOffset, segmentHeight }, { { xOffset + 1, yOffset + 16, segmentHeight }, { 10, 10, 1 } }); - if (ps != nullptr) - { - ps->image_id = ps->image_id.WithTertiary(COLOUR_BORDEAUX_RED); - } } } }