Fix #20433. Dropdown default selections not working (#20437)

This fixes it for rides but it is also an issue effecting a few different dropdowns
This commit is contained in:
Duncan 2023-06-23 06:20:02 +01:00 committed by GitHub
parent a6d3dbc6d9
commit 622c8cdb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 4 deletions

View File

@ -381,6 +381,10 @@ public:
void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override
{
if (dropdownIndex == -1)
{
return;
}
switch (widgetIndex)
{
case WIDX_PAGE_DROPDOWN_BUTTON:

View File

@ -169,6 +169,10 @@ public:
void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override
{
if (selectedIndex == -1)
{
return;
}
auto serverIndex = selected_list_item;
if (serverIndex >= 0 && serverIndex < static_cast<int32_t>(_serverList.GetCount()))
{

View File

@ -238,6 +238,10 @@ public:
void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override
{
if (dropdownIndex == -1)
{
return;
}
if (widgetIndex == WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER)
{
auto action = StaffSetColourAction(GetSelectedStaffType(), ColourDropDownIndexToColour(dropdownIndex));

View File

@ -219,6 +219,10 @@ public:
void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override
{
if (selectedIndex == -1)
{
return;
}
if (widgetIndex == WIDX_GAME_TOOLS)
{
switch (selectedIndex)

View File

@ -2653,6 +2653,10 @@ public:
void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override
{
if (selectedIndex == -1)
{
return;
}
switch (widgetIndex)
{
case WIDX_FILE_MENU:

View File

@ -1447,10 +1447,7 @@ void WindowEventDropdownCall(WindowBase* w, WidgetIndex widgetIndex, int32_t dro
{
if (w->event_handlers == nullptr)
{
if (dropdownIndex != -1)
{
w->OnDropdown(widgetIndex, dropdownIndex);
}
w->OnDropdown(widgetIndex, dropdownIndex);
}
else if (w->event_handlers->dropdown != nullptr)
{