diff --git a/src/main.cpp b/src/main.cpp index 85e4701..e064315 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,8 +86,7 @@ const BYTE PixelShader[] = #endif CMyAddon::CMyAddon() - : m_asteroids(nullptr), - m_timer(nullptr) + : m_timer(nullptr) { } @@ -127,9 +126,7 @@ bool CMyAddon::Start() m_Height = Height(); srand((u32)time(nullptr)); - m_asteroids = new CAsteroids(this); - if (!m_asteroids) - return false; + m_asteroids = std::make_unique(this); m_timer = new CTimer(); m_timer->Init(); @@ -179,7 +176,6 @@ void CMyAddon::Stop() #endif m_asteroids->InvalidateDevice(); - SAFE_DELETE(m_asteroids); SAFE_DELETE(m_timer); #ifndef WIN32 diff --git a/src/main.h b/src/main.h index 94e42f3..c46b94a 100644 --- a/src/main.h +++ b/src/main.h @@ -19,6 +19,8 @@ #include #endif +#include + #include #include #include "types.h" @@ -83,7 +85,7 @@ class ATTR_DLL_LOCAL CMyAddon ID3D11PixelShader* m_pPShader; #endif - CAsteroids* m_asteroids; + std::unique_ptr m_asteroids; CTimer* m_timer; };