1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 17:42:29 +01:00

Order custom menus consistently by label text (#24067)

This commit is contained in:
Aaron van Geffen
2025-03-24 18:42:05 +01:00
committed by GitHub
parent 185c601191
commit 472ab1996a
2 changed files with 4 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
- Feature: [#23876] New park save files now contain a preview image, shown in the load/save window.
- Change: [#23932] The land rights window now checks “Land Owned” by default.
- Change: [#23936] The guests prefer less/more intense rides settings have been turned into a dropdown.
- Change: [#24067] [Plugin] Registered menu items are now listed alphabetically.
- Fix: [#4225] Ride Construction window offers non-existent banked sloped to level curve (original bug).
- Fix: [#5281] Missing supports on miniature railways built backwards.
- Fix: [#10379] Banners outside the park can be renamed and modified (original bug).

View File

@@ -18,6 +18,7 @@
#include "ScViewport.hpp"
#include "ScWindow.hpp"
#include <algorithm>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/Input.h>
@@ -324,6 +325,7 @@ namespace OpenRCT2::Scripting
auto& execInfo = _scriptEngine.GetExecInfo();
auto owner = execInfo.GetCurrentPlugin();
CustomMenuItems.emplace_back(owner, CustomToolbarMenuItemKind::Standard, text, callback);
std::ranges::sort(CustomMenuItems, [](auto&& a, auto&& b) { return a.Text < b.Text; });
}
void registerToolboxMenuItem(const std::string& text, DukValue callback)
@@ -333,6 +335,7 @@ namespace OpenRCT2::Scripting
if (owner->GetMetadata().Type == PluginType::Intransient)
{
CustomMenuItems.emplace_back(owner, CustomToolbarMenuItemKind::Toolbox, text, callback);
std::ranges::sort(CustomMenuItems, [](auto&& a, auto&& b) { return a.Text < b.Text; });
}
else
{