From c687b59efcd56789fb62cbef035aed8089b37098 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 31 Oct 2023 18:53:07 +0000 Subject: [PATCH] Codechange: Use unique_ptr for SmallMapWindow's overlay. --- src/smallmap_gui.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index e2ec46f9d8..ae2473f4ec 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -648,7 +648,7 @@ protected: int32_t subscroll; ///< Number of pixels (0..3) between the right end of the base tile and the pixel at the top-left corner of the smallmap display. int zoom; ///< Zoom level. Bigger number means more zoom-out (further away). - LinkGraphOverlay *overlay; + std::unique_ptr overlay; /** Notify the industry chain window to stop sending newly selected industries. */ static void BreakIndustryChainLink() @@ -1402,7 +1402,7 @@ public: SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc) { _smallmap_industry_highlight = INVALID_INDUSTRYTYPE; - this->overlay = new LinkGraphOverlay(this, WID_SM_MAP, 0, this->GetOverlayCompanyMask(), 1); + this->overlay = std::make_unique(this, WID_SM_MAP, 0, this->GetOverlayCompanyMask(), 1); this->InitNested(window_number); this->LowerWidget(this->map_type + WID_SM_CONTOUR); @@ -1419,11 +1419,6 @@ public: this->SetOverlayCargoMask(); } - virtual ~SmallMapWindow() - { - delete this->overlay; - } - /** * Center the small map on the current center of the viewport. */