From a9cd89d02eb9809afb0b54fc58ae248c765c6292 Mon Sep 17 00:00:00 2001 From: Sadret Date: Sun, 13 Sep 2020 00:24:23 +0200 Subject: [PATCH] Fix #12912: Plugin: selectedCell of CustomListView (#12913) --- contributors.md | 1 + distribution/changelog.txt | 1 + src/openrct2-ui/scripting/CustomWindow.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/contributors.md b/contributors.md index 6c88a42578..122f1c4c16 100644 --- a/contributors.md +++ b/contributors.md @@ -156,6 +156,7 @@ The following people are not part of the development team, but have been contrib * Simon Jarrett (mwnciau) * Richard Fine (richard-fine) * Tom Parsons (tombomp) +* Stephan Spengler (Sadret) ## Toolchain * (Balletie) - macOS diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d8343a3f47..b198b4b220 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#12857] Incorrect Peep thoughts in imported RCT1 parks. - Fix: [#12881] Guests' favourite rides are not listed in the guest window. - Fix: [#12910] Plugin API: getRide sometimes returns null for valid ride IDs. +- Fix: [#12912] Plugin: selectedCell of CustomListView is being ignored on creation. - Fix: Incomplete loop collision box allowed overlapping track (original bug). - Improved: [#12806] Add Esperanto diacritics to the sprite font. - Improved: [#12890] Add stroke to lowercase 'L' to differentiate from capital 'I'. diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 05a6f8b91c..1efbfe225d 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -110,6 +110,7 @@ namespace OpenRCT2::Ui::Windows std::vector ListViewColumns; ScrollbarType Scrollbars{}; int32_t SelectedIndex{}; + std::optional SelectedCell; bool IsChecked{}; bool IsDisabled{}; bool IsPressed{}; @@ -177,6 +178,7 @@ namespace OpenRCT2::Ui::Windows { result.ListViewColumns = FromDuk>(desc["columns"]); result.ListViewItems = FromDuk>(desc["items"]); + result.SelectedCell = FromDuk>(desc["selectedCell"]); result.ShowColumnHeaders = AsOrDefault(desc["showColumnHeaders"], false); result.IsStriped = AsOrDefault(desc["isStriped"], false); result.OnClick = desc["onClick"]; @@ -1007,6 +1009,7 @@ namespace OpenRCT2::Ui::Windows listView.SetScrollbars(widgetDesc.Scrollbars, true); listView.SetColumns(widgetDesc.ListViewColumns, true); listView.SetItems(widgetDesc.ListViewItems, true); + listView.SelectedCell = widgetDesc.SelectedCell; listView.ShowColumnHeaders = widgetDesc.ShowColumnHeaders; listView.IsStriped = widgetDesc.IsStriped; listView.OnClick = widgetDesc.OnClick;