From fd720c0a7b8e17a33aca188620a8462e8439f40e Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Wed, 31 Aug 2022 18:03:46 +0200 Subject: [PATCH] Use std::unique_ptr in HUD --- apps/openmw/mwgui/hud.cpp | 4 +--- apps/openmw/mwgui/hud.hpp | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 1d6b981bcd..028da083f5 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -163,7 +163,7 @@ namespace MWGui mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver); mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus); - mSpellIcons = new SpellIcons(); + mSpellIcons = std::make_unique(); } HUD::~HUD() @@ -171,8 +171,6 @@ namespace MWGui mMainWidget->eventMouseLostFocus.clear(); mMainWidget->eventMouseMove.clear(); mMainWidget->eventMouseButtonClick.clear(); - - delete mSpellIcons; } void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat& value) diff --git a/apps/openmw/mwgui/hud.hpp b/apps/openmw/mwgui/hud.hpp index ef591bec97..becffa22d8 100644 --- a/apps/openmw/mwgui/hud.hpp +++ b/apps/openmw/mwgui/hud.hpp @@ -1,6 +1,8 @@ #ifndef OPENMW_GAME_MWGUI_HUD_H #define OPENMW_GAME_MWGUI_HUD_H +#include + #include "mapwindow.hpp" #include "statswatcher.hpp" @@ -95,7 +97,7 @@ namespace MWGui bool mWorldMouseOver; - SpellIcons* mSpellIcons; + std::unique_ptr mSpellIcons; int mEnemyActorId; float mEnemyHealthTimer;