Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate copy-free code for most situations.
This commit is contained in:
@@ -214,12 +214,12 @@ class BuildAirportWindow : public PickerWindowBase {
|
||||
Scrollbar *vscroll;
|
||||
|
||||
/** Build a dropdown list of available airport classes */
|
||||
static DropDownList *BuildAirportClassDropDown()
|
||||
static DropDownList BuildAirportClassDropDown()
|
||||
{
|
||||
DropDownList *list = new DropDownList();
|
||||
DropDownList list;
|
||||
|
||||
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
|
||||
list->push_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
|
||||
list.emplace_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
Reference in New Issue
Block a user