diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2122,7 +2122,7 @@ struct MainToolbarWindow : Window { }}; }; -static NWidgetBase *MakeMainToolbar() +static std::unique_ptr MakeMainToolbar() { /** Sprites to use for the different toolbar buttons */ static const SpriteID toolbar_button_sprites[] = { @@ -2159,7 +2159,7 @@ static NWidgetBase *MakeMainToolbar() SPR_IMG_SWITCH_TOOLBAR, // WID_TN_SWITCH_BAR }; - NWidgetMainToolbarContainer *hor = new NWidgetMainToolbarContainer(); + auto hor = std::make_unique(); for (WidgetID i = 0; i < WID_TN_END; i++) { switch (i) { case WID_TN_SMALL_MAP: @@ -2168,12 +2168,12 @@ static NWidgetBase *MakeMainToolbar() case WID_TN_ZOOM_IN: case WID_TN_BUILDING_TOOLS_START: case WID_TN_MUSIC_SOUND: - hor->Add(new NWidgetSpacer(0, 0)); + hor->Add(std::make_unique(0, 0)); break; } - NWidgetLeaf *leaf = new NWidgetLeaf(i == WID_TN_SAVE ? WWT_IMGBTN_2 : WWT_IMGBTN, COLOUR_GREY, i, toolbar_button_sprites[i], STR_TOOLBAR_TOOLTIP_PAUSE_GAME + i); + auto leaf = std::make_unique(i == WID_TN_SAVE ? WWT_IMGBTN_2 : WWT_IMGBTN, COLOUR_GREY, i, toolbar_button_sprites[i], STR_TOOLBAR_TOOLTIP_PAUSE_GAME + i); leaf->SetMinimalSize(20, 20); - hor->Add(leaf); + hor->Add(std::move(leaf)); } return hor; @@ -2514,9 +2514,9 @@ static const NWidgetPart _nested_toolb_s NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_SWITCH_BAR), SetDataTip(SPR_IMG_SWITCH_TOOLBAR, STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR), }; -static NWidgetBase *MakeScenarioToolbar() +static std::unique_ptr MakeScenarioToolbar() { - return MakeNWidgets(std::begin(_nested_toolb_scen_inner_widgets), std::end(_nested_toolb_scen_inner_widgets), new NWidgetScenarioToolbarContainer()); + return MakeNWidgets(std::begin(_nested_toolb_scen_inner_widgets), std::end(_nested_toolb_scen_inner_widgets), std::make_unique()); } static const NWidgetPart _nested_toolb_scen_widgets[] = {