1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 01:42:38 +01:00

Add: Configuration of NewGRF badges.

This commit is contained in:
Peter Nelson
2025-05-23 17:44:19 +01:00
committed by Peter Nelson
parent daef052329
commit c2d4098afa
12 changed files with 470 additions and 9 deletions

View File

@@ -347,9 +347,10 @@ struct DropdownWindow : Window {
}
}
void ReplaceList(DropDownList &&list)
void ReplaceList(DropDownList &&list, std::optional<int> selected_result)
{
this->list = std::move(list);
if (selected_result.has_value()) this->selected_result = *selected_result;
this->UpdateSizeAndPosition();
this->ReInit(0, 0);
this->InitializePositionSize(this->position.x, this->position.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
@@ -358,10 +359,10 @@ struct DropdownWindow : Window {
}
};
void ReplaceDropDownList(Window *parent, DropDownList &&list)
void ReplaceDropDownList(Window *parent, DropDownList &&list, std::optional<int> selected_result)
{
DropdownWindow *ddw = dynamic_cast<DropdownWindow *>(parent->FindChildWindow(WC_DROPDOWN_MENU));
if (ddw != nullptr) ddw->ReplaceList(std::move(list));
if (ddw != nullptr) ddw->ReplaceList(std::move(list), selected_result);
}
/**