1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-25 05:04:07 +01:00

Codechange: remove INVALID_STRING_ID now drop down uses spans

This commit is contained in:
Rubidium
2024-04-28 16:03:29 +02:00
committed by rubidium42
parent 37a03b513f
commit d183d8e587
11 changed files with 19 additions and 43 deletions

View File

@@ -431,7 +431,7 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID but
* Show a dropdown menu window near a widget of the parent window.
* The result code of the items is their index in the \a strings list.
* @param w Parent window that wants the dropdown menu.
* @param strings Menu list, end with #INVALID_STRING_ID
* @param strings Menu list.
* @param selected Index of initial selected item.
* @param button Button widget number of the parent window \a w that wants the dropdown menu.
* @param disabled_mask Bitmask for disabled items (items with their bit set are displayed, but not selectable in the dropdown list).
@@ -442,10 +442,12 @@ void ShowDropDownMenu(Window *w, std::span<const StringID> strings, int selected
{
DropDownList list;
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
uint i = 0;
for (auto string : strings) {
if (!HasBit(hidden_mask, i)) {
list.push_back(MakeDropDownListStringItem(strings[i], i, HasBit(disabled_mask, i)));
list.push_back(MakeDropDownListStringItem(string, i, HasBit(disabled_mask, i)));
}
++i;
}
if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width);