diff --git a/distribution/changelog.txt b/distribution/changelog.txt index de275a2a89..c9df1b69c6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,9 +1,10 @@ 0.3.2+ (in development) ------------------------------------------------------------------------ - Feature: [#13057] Make GameAction flags accessible by plugins. -- Change: [#13346] Change FootpathScenery to FootpathAddition in all occurrences -- Fix: [#13334] Uninitialised variables in CustomTabDesc -- Fix: [#13342] Rename tabChange to onTabChange in WindowDesc interface +- Feature: [#13376] Open custom window at specified tab. +- Change: [#13346] Change FootpathScenery to FootpathAddition in all occurrences. +- Fix: [#13334] Uninitialised variables in CustomTabDesc. +- Fix: [#13342] Rename tabChange to onTabChange in WindowDesc interface. - Improved: [#12917] Changed peep movement so that they stay more spread out over the full width of single tile paths. 0.3.2 (2020-11-01) diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index c10b2e7593..678e60e707 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -1866,6 +1866,7 @@ declare global { widgets?: Widget[]; colours?: number[]; tabs?: WindowTabDesc[]; + tabIndex: number; onClose?: () => void; onUpdate?: () => void; diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 5f6604dcc6..af7ccf415a 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -244,6 +244,7 @@ namespace OpenRCT2::Ui::Windows std::vector Widgets; std::vector Colours; std::vector Tabs; + std::optional TabIndex; // Event handlers DukValue OnClose; @@ -271,6 +272,7 @@ namespace OpenRCT2::Ui::Windows result.MaxHeight = GetOptionalInt(desc["maxHeight"]); result.Title = language_convert_string(desc["title"].as_string()); result.Id = GetOptionalInt(desc["id"]); + result.TabIndex = GetOptionalInt(desc["tabIndex"]); if (desc["widgets"].is_array()) { @@ -392,6 +394,9 @@ namespace OpenRCT2::Ui::Windows window->custom_info = new CustomWindowInfo(owner, desc); window->enabled_widgets = (1 << WIDX_CLOSE); + // Set window tab + window->page = desc.TabIndex.value_or(0); + // Set window colours window->colours[0] = COLOUR_GREY; window->colours[1] = COLOUR_GREY; diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 59c7b8addd..c9720a81d4 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -43,7 +43,7 @@ using namespace OpenRCT2; using namespace OpenRCT2::Scripting; -static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 9; +static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 10; struct ExpressionStringifier final {