From bc055f40318e3639b93a46659df027a090dd94e3 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 7 Aug 2024 14:45:38 +0200 Subject: [PATCH] Replace SCROLLBAR_SIZE macro with kScrollBarWidth constant --- src/openrct2-ui/windows/Map.cpp | 10 +++++----- src/openrct2/interface/Window.h | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index c7cfea0a5f..744b1d63f4 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -82,7 +82,7 @@ namespace OpenRCT2::Ui::Windows static int32_t getMapOffset(int16_t width) { - return (width - getMiniMapWidth() - kReservedHSpace - SCROLLBAR_SIZE) / 2; + return (width - getMiniMapWidth() - kReservedHSpace - kScrollBarWidth) / 2; } // Some functions manipulate coordinates on the map. These are the coordinates of the pixels in the @@ -649,7 +649,7 @@ static Widget window_map_widgets[] = { auto mapOffset = getMapOffset(width); if (mapOffset > 0) { - adjCoords -= ScreenCoordsXY(mapOffset, mapOffset - SCROLLBAR_SIZE / 2); + adjCoords -= ScreenCoordsXY(mapOffset, mapOffset - kScrollBarWidth); } CoordsXY c = ScreenToMap(adjCoords); @@ -718,7 +718,7 @@ static Widget window_map_widgets[] = { auto screenOffset = ScreenCoordsXY(0, 0); auto mapOffset = getMapOffset(width); if (mapOffset > 0) - screenOffset += ScreenCoordsXY(mapOffset, mapOffset - SCROLLBAR_SIZE / 2); + screenOffset += ScreenCoordsXY(mapOffset, mapOffset - kScrollBarWidth); G1Element g1temp = {}; g1temp.offset = _mapImageData.data(); @@ -1408,7 +1408,7 @@ static Widget window_map_widgets[] = { width = initSize + kReservedHSpace; height = initSize + kReservedTopSpace + GetReservedBottomSpace(); - auto scrollbarSize = getTechnicalMapSize() > 254 ? SCROLLBAR_SIZE : 2; + auto scrollbarSize = getTechnicalMapSize() > 254 ? kScrollBarWidth : 2; width += scrollbarSize; height += scrollbarSize; @@ -1423,7 +1423,7 @@ static Widget window_map_widgets[] = { max_height = std::clamp( getMiniMapWidth() + kReservedTopSpace + GetReservedBottomSpace(), WH, ContextGetHeight() - 68); - auto scrollbarSize = getMiniMapWidth() + kReservedHSpace > ContextGetWidth() ? SCROLLBAR_SIZE : 2; + auto scrollbarSize = getMiniMapWidth() + kReservedHSpace > ContextGetWidth() ? kScrollBarWidth : 2; max_width += scrollbarSize; max_height += scrollbarSize; } diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 9ccc59e3ff..ff4a6406f3 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -286,8 +286,6 @@ enum SCROLL_FLAGS VSCROLLBAR_DOWN_PRESSED = (1 << 7), }; -#define SCROLLBAR_SIZE 16 - enum { SCROLL_PART_NONE = -1,