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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user