Use std::unique_ptr in HUD

This commit is contained in:
Evil Eye 2022-08-31 18:03:46 +02:00
parent b21c77a026
commit fd720c0a7b
2 changed files with 4 additions and 4 deletions

View file

@ -163,7 +163,7 @@ namespace MWGui
mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver); mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus); mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);
mSpellIcons = new SpellIcons(); mSpellIcons = std::make_unique<SpellIcons>();
} }
HUD::~HUD() HUD::~HUD()
@ -171,8 +171,6 @@ namespace MWGui
mMainWidget->eventMouseLostFocus.clear(); mMainWidget->eventMouseLostFocus.clear();
mMainWidget->eventMouseMove.clear(); mMainWidget->eventMouseMove.clear();
mMainWidget->eventMouseButtonClick.clear(); mMainWidget->eventMouseButtonClick.clear();
delete mSpellIcons;
} }
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value) void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)

View file

@ -1,6 +1,8 @@
#ifndef OPENMW_GAME_MWGUI_HUD_H #ifndef OPENMW_GAME_MWGUI_HUD_H
#define OPENMW_GAME_MWGUI_HUD_H #define OPENMW_GAME_MWGUI_HUD_H
#include <memory>
#include "mapwindow.hpp" #include "mapwindow.hpp"
#include "statswatcher.hpp" #include "statswatcher.hpp"
@ -95,7 +97,7 @@ namespace MWGui
bool mWorldMouseOver; bool mWorldMouseOver;
SpellIcons* mSpellIcons; std::unique_ptr<SpellIcons> mSpellIcons;
int mEnemyActorId; int mEnemyActorId;
float mEnemyHealthTimer; float mEnemyHealthTimer;