From 2592b3a4ab4df63609aa94588ae7cb0ed14b30df Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Tue, 30 Nov 2021 19:06:26 +0100 Subject: [PATCH] Use ScreenRect::Contains to check for clicked area --- src/openrct2-ui/windows/TileInspector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index dd36ffae21..5016412d86 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1338,7 +1338,8 @@ static void WindowTileInspectorScrollmousedown(rct_window* w, int32_t scrollInde // Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; - if (screenCoords.x >= 2 && screenCoords.x <= 11) + const ScreenRect checkboxColumnRect{ { 2, 0 }, { 11, screenCoords.y } }; + if (checkboxColumnRect.Contains(screenCoords)) { // Checkbox was clicked WindowTileInspectorToggleInvisibility(index); }