From 5b3c8d8971bac0ae1a14c3bbb7c63a1da0415f05 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Fri, 10 Jan 2025 15:40:22 +0100 Subject: [PATCH] Fix positioning of "Install new track" button --- distribution/changelog.txt | 1 + .../windows/EditorObjectSelection.cpp | 11 ++++--- src/openrct2/interface/Window.h | 32 ++++++++++++------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index cd82606b3f..bf3503ffd9 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -7,6 +7,7 @@ - Fix: [#21794] Lay-down coaster cars reverse on first frames of downwards corkscrew. - Fix: [#23508] Simultaneous virtual floors shown for ride and footpath. - Fix: [#23581] [Plugin] Food/drink items given to guests have no consumption duration set. +- Fix: [#23591] “Install new track” button in Track Designs Manager is misaligned. 0.4.18 (2025-01-08) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index c4feb89191..4c19602a2f 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -234,7 +234,7 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 0, 43}, {WW, 357}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeWidget ({ 4, 60}, {288, 277}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), MakeWidget ({391, 45}, {114, 114}, WindowWidgetType::FlatBtn, WindowColour::Secondary ), - MakeWidget ({350, 22}, {122, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN, STR_INSTALL_NEW_TRACK_DESIGN_TIP ), + MakeWidget ({340, 22}, {122, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN, STR_INSTALL_NEW_TRACK_DESIGN_TIP ), MakeDropdownWidgets({470, 22}, {114, 14}, WindowWidgetType::DropdownMenu, WindowColour::Primary, STR_OBJECT_FILTER, STR_OBJECT_FILTER_TIP ), MakeWidget ({ 4, 45}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget ({218, 45}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ), @@ -858,19 +858,20 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_LIST].bottom = height - 14; widgets[WIDX_PREVIEW].left = width - 209; widgets[WIDX_PREVIEW].right = width - 96; - ResizeDropdown(WIDX_FILTER_DROPDOWN, { width - kFilterWidth - 10, 22 }, { kFilterWidth, 14 }); - widgets[WIDX_INSTALL_TRACK].left = width - 250; - widgets[WIDX_INSTALL_TRACK].right = width - 137; widgets[WIDX_RELOAD_OBJECT].left = width - 9 - 24; widgets[WIDX_RELOAD_OBJECT].right = width - 9; + auto& dropdownWidget = widgets[WIDX_FILTER_DROPDOWN]; + ResizeDropdown(WIDX_FILTER_DROPDOWN, { width - kFilterWidth - 10, dropdownWidget.top }, { kFilterWidth, 14 }); + auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; + installTrackWidget.moveToX(dropdownWidget.left - installTrackWidget.width() - 10); + // Set pressed widgets pressed_widgets |= 1uLL << WIDX_PREVIEW; SetPressedTab(); // Set window title and buttons auto& titleWidget = widgets[WIDX_TITLE]; - auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { titleWidget.text = STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE; diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 6527957ad4..72c8446e25 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -140,6 +140,16 @@ struct Widget moveDown(coords.y - top); } + void moveToX(int16_t x) + { + moveRight(x - left); + } + + void moveToY(int16_t y) + { + moveDown(y - top); + } + bool IsVisible() const { return !(flags & OpenRCT2::WIDGET_FLAGS::IS_HIDDEN); @@ -322,17 +332,17 @@ constexpr int32_t WC_TRACK_DESIGN_PLACE__WIDX_ROTATE = 3; constexpr int32_t WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON = 6; constexpr int32_t WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 = 22; constexpr int32_t WC_STAFF__WIDX_PICKUP = 9; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE = 13; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_COPY = 16; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE = 15; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_SORT = 14; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE = 10; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP = 11; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN = 12; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE = 5; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE = 6; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE = 8; -constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE = 9; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE = 15; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_COPY = 18; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE = 17; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_SORT = 16; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE = 12; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP = 13; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN = 14; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE = 6; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE = 7; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE = 10; +constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE = 11; constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE = EnumValue(TileInspectorPage::Surface); constexpr int32_t WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE = 27; constexpr int32_t WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE = 28;