From bdb4823d4853cf26e8ed126205f9c402b7eec040 Mon Sep 17 00:00:00 2001 From: mrmbernardi Date: Mon, 22 Jul 2024 06:32:23 +1000 Subject: [PATCH] Fix #22209: Water tool selection may disappear near edge of map (#22256) --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/TopToolbar.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index aeb2acf8a9..95a64827ec 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Fix: [#19210] The load/save window executes the loading code twice, resulting in a slowdown. - Fix: [#22056] Potential crash upon exiting the game. - Fix: [#22208] Cursor may fail to register hits in some cases (original bug). +- Fix: [#22209] Water tool selection may disappear near edge of map. - Fix: [#22222] Staff list may remain invalid when changing tabs. - Fix: [#22284] Unrated rides cause high amount of nausea. - Fix: [#22304] Graphs don't draw lines on the left edge of the screen. diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 82e2f7bf95..0c782f9746 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -790,7 +790,7 @@ namespace OpenRCT2::Ui::Windows return; } - auto mapTile = info.Loc.ToTileCentre(); + auto mapTile = info.Loc; uint8_t state_changed = 0; @@ -806,14 +806,12 @@ namespace OpenRCT2::Ui::Windows state_changed++; } - int16_t tool_size = std::max(1, gLandToolSize); - int16_t tool_length = (tool_size - 1) * 32; + uint16_t tool_size = std::max(1, gLandToolSize); + uint16_t tool_length = (tool_size - 1) * COORDS_XY_STEP; // Move to tool bottom left - mapTile.x -= (tool_size - 1) * 16; - mapTile.y -= (tool_size - 1) * 16; - mapTile.x &= 0xFFE0; - mapTile.y &= 0xFFE0; + mapTile.x -= tool_length / 2; + mapTile.y -= tool_length / 2; if (gMapSelectPositionA.x != mapTile.x) {