Codechange: Use functions to create common drop down list items.
This commit is contained in:

committed by
Peter Nelson

parent
11aa3694fa
commit
56cac21086
@@ -394,7 +394,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
|
||||
DropDownList list;
|
||||
for (uint32_t i = par_info.min_value; i <= par_info.max_value; i++) {
|
||||
list.push_back(std::make_unique<DropDownListStringItem>(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i, false));
|
||||
list.push_back(MakeDropDownListStringItem(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i));
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, std::move(list), old_val, WID_NP_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE);
|
||||
@@ -955,10 +955,10 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||
DropDownList list;
|
||||
|
||||
/* Add 'None' option for clearing list */
|
||||
list.push_back(std::make_unique<DropDownListStringItem>(STR_NONE, -1, false));
|
||||
list.push_back(MakeDropDownListStringItem(STR_NONE, -1));
|
||||
|
||||
for (uint i = 0; i < this->grf_presets.size(); i++) {
|
||||
list.push_back(std::make_unique<DropDownListStringItem>(this->grf_presets[i], i, false));
|
||||
list.push_back(MakeDropDownListStringItem(this->grf_presets[i], i));
|
||||
}
|
||||
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
|
Reference in New Issue
Block a user