diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 132602dbe9..9ce7c89136 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.5 (in development) ------------------------------------------------------------------------ +- Improved: [#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab. - Fix: [#19296] Crash due to a race condition for parallel object loading. - Fix: [#19756] Crash with title sequences containing no commands. - Fix: [#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics. diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index c0de26e1b7..ebef5b7313 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -48,7 +48,7 @@ constexpr int32_t TabWidth = 31; constexpr int32_t TabHeight = 28; constexpr int32_t ReservedTabCount = 2; constexpr int32_t MaxTabs = 257; // 255 selected tabs + misc + all -constexpr int32_t MaxTabsPerRow = 19; +constexpr int32_t MaxTabsPerRow = 20; constexpr uint8_t SceneryContentScrollIndex = 0; @@ -720,6 +720,15 @@ public: const auto lastTabWidget = &widgets[WIDX_SCENERY_TAB_1 + lastTabIndex]; windowWidth = std::max(windowWidth, lastTabWidget->right + 3); + if (GetSceneryTabInfoForMisc() != nullptr) + { + auto miscTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 2]; + miscTabWidget->left = windowWidth - 2 * TabWidth - 6; + miscTabWidget->right = windowWidth - TabWidth - 7; + miscTabWidget->top = InitTabPosY; + miscTabWidget->bottom = InitTabPosY + TabHeight; + } + if (_tabEntries.back().IsAll()) { auto allTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 1]; @@ -1223,8 +1232,7 @@ private: int32_t GetTabRowCount() { - int32_t tabEntries = static_cast(_tabEntries.size() - 1); - return std::max((tabEntries + MaxTabsPerRow - 1) / MaxTabsPerRow, 0); + return std::max((static_cast(_tabEntries.size()) + MaxTabsPerRow - 1) / MaxTabsPerRow, 0); } int32_t GetMaxTabCountInARow() @@ -1251,6 +1259,9 @@ private: int32_t xInit = InitTabPosX; int32_t tabsInThisRow = 0; + auto hasMisc = GetSceneryTabInfoForMisc() != nullptr; + auto maxTabsInThisRow = MaxTabsPerRow - 1 - (hasMisc ? 1 : 0); + ScreenCoordsXY pos = { xInit, InitTabPosY }; for (const auto& tabInfo : _tabEntries) { @@ -1281,12 +1292,13 @@ private: _widgets.push_back(widget); tabsInThisRow++; - if (tabsInThisRow >= MaxTabsPerRow) + if (tabsInThisRow >= maxTabsInThisRow) { pos.x = xInit; pos.y += TabHeight; tabsInThisRow = 0; _actualMinHeight += TabHeight; + maxTabsInThisRow = MaxTabsPerRow; } }