1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 15:45:35 +00:00

Use std::unique_ptr in MainMenu

This commit is contained in:
Evil Eye 2022-08-31 19:05:32 +02:00
parent 59fab4c9e2
commit 30d320f651
2 changed files with 4 additions and 9 deletions

View file

@ -28,7 +28,6 @@ namespace MWGui
, mBackground(nullptr)
, mVideoBackground(nullptr)
, mVideo(nullptr)
, mSaveGameDialog(nullptr)
{
getWidget(mVersionText, "VersionText");
mVersionText->setCaption(versionDescription);
@ -38,11 +37,6 @@ namespace MWGui
updateMenu();
}
MainMenu::~MainMenu()
{
delete mSaveGameDialog;
}
void MainMenu::onResChange(int w, int h)
{
mWidth = w;
@ -133,7 +127,7 @@ namespace MWGui
else
{
if (!mSaveGameDialog)
mSaveGameDialog = new SaveGameDialog();
mSaveGameDialog = std::make_unique<SaveGameDialog>();
if (name == "loadgame")
mSaveGameDialog->setLoadOrSave(true);
else if (name == "savegame")

View file

@ -1,6 +1,8 @@
#ifndef OPENMW_GAME_MWGUI_MAINMENU_H
#define OPENMW_GAME_MWGUI_MAINMENU_H
#include <memory>
#include "windowbase.hpp"
namespace Gui
@ -30,7 +32,6 @@ namespace MWGui
public:
MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription);
~MainMenu();
void onResChange(int w, int h) override;
@ -61,7 +62,7 @@ namespace MWGui
void updateMenu();
SaveGameDialog* mSaveGameDialog;
std::unique_ptr<SaveGameDialog> mSaveGameDialog;
};
}