From 0436dd1abed2b1e2c9deff851e5e911bc255a29e Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 12 Jan 2024 17:35:16 +0000 Subject: [PATCH] Move instead of copy town list into ShowSelectTownWindow --- src/town_gui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 7131301ade..37618d1a0d 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -2063,7 +2063,7 @@ struct SelectTownWindow : Window { CommandContainer cmd; ///< command to build the house (CMD_BUILD_HOUSE) Scrollbar *vscroll; ///< scrollbar for the town list - SelectTownWindow(WindowDesc *desc, const TownList &towns, const CommandContainer &cmd) : Window(desc), towns(towns), cmd(cmd) + SelectTownWindow(WindowDesc *desc, TownList towns, const CommandContainer &cmd) : Window(desc), towns(std::move(towns)), cmd(cmd) { this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_ST_SCROLLBAR); @@ -2146,10 +2146,10 @@ static WindowDesc _select_town_desc(__FILE__, __LINE__, std::begin(_nested_select_town_widgets), std::end(_nested_select_town_widgets) ); -static void ShowSelectTownWindow(const TownList &towns, const CommandContainer &cmd) +static void ShowSelectTownWindow(TownList towns, const CommandContainer &cmd) { CloseWindowByClass(WC_SELECT_TOWN); - new SelectTownWindow(&_select_town_desc, towns, cmd); + new SelectTownWindow(&_select_town_desc, std::move(towns), cmd); } static void PlaceProc_House(TileIndex tile) @@ -2210,7 +2210,7 @@ static void PlaceProc_House(TileIndex tile) DoCommandP(&cmd); } else { if (!_settings_client.gui.persistent_buildingtools) CloseWindowById(WC_BUILD_HOUSE, 0); - ShowSelectTownWindow(towns, cmd); + ShowSelectTownWindow(std::move(towns), cmd); } }