Codechange: Use std::unique_ptr for all NWidgets.

This commit is contained in:
Peter Nelson
2023-12-30 07:36:22 +00:00
committed by Peter Nelson
parent 9a3934ae23
commit 7124b4eef1
15 changed files with 200 additions and 212 deletions

View File

@@ -1944,12 +1944,12 @@ static const NWidgetPart _nested_smallmap_bar[] = {
EndContainer(),
};
static NWidgetBase *SmallMapDisplay()
static std::unique_ptr<NWidgetBase> SmallMapDisplay()
{
NWidgetContainer *map_display = new NWidgetSmallmapDisplay;
std::unique_ptr<NWidgetBase> map_display = std::make_unique<NWidgetSmallmapDisplay>();
MakeNWidgets(std::begin(_nested_smallmap_display), std::end(_nested_smallmap_display), map_display);
MakeNWidgets(std::begin(_nested_smallmap_bar), std::end(_nested_smallmap_bar), map_display);
map_display = MakeNWidgets(std::begin(_nested_smallmap_display), std::end(_nested_smallmap_display), std::move(map_display));
map_display = MakeNWidgets(std::begin(_nested_smallmap_bar), std::end(_nested_smallmap_bar), std::move(map_display));
return map_display;
}