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:
@@ -467,10 +467,10 @@ public:
|
||||
break;
|
||||
|
||||
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
|
||||
DropDownList *list = new DropDownList();
|
||||
list->push_back(new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false));
|
||||
list->push_back(new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false));
|
||||
ShowDropDownList(this, list, this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
|
||||
DropDownList list;
|
||||
list.emplace_back(new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false));
|
||||
list.emplace_back(new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false));
|
||||
ShowDropDownList(this, std::move(list), this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user