diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-04-02 21:31:24 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-09 22:45:15 +0200 |
commit | c7b9987d081ae4e0103309b18c93deecc395dec9 (patch) | |
tree | e5b1f9553d6399e2eed9c05a2d91673205f9c912 /src/autoreplace_gui.cpp | |
parent | d3e113eb5f618ce0174fa0dfa2591cb96e999350 (diff) | |
download | openttd-c7b9987d081ae4e0103309b18c93deecc395dec9.tar.xz |
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.
Diffstat (limited to 'src/autoreplace_gui.cpp')
-rw-r--r-- | src/autoreplace_gui.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 78c2fdc31..40f8d8ef2 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -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; } |