summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/GameWinDX9.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-06 21:28:00 +0200
committerAki <please@ignore.pl>2022-04-06 21:53:47 +0200
commit947910fc3c541ffdab3b042cfa3a3926b64f0ba3 (patch)
treea4d6b261d0edaa516d34b3fcb4baa8f84381adad /StarsEx/GameWinDX9.cpp
parenta793e933b1e7e5b62fe4e15403e1d5fb33dc2dd4 (diff)
downloadstarshatter-947910fc3c541ffdab3b042cfa3a3926b64f0ba3.zip
starshatter-947910fc3c541ffdab3b042cfa3a3926b64f0ba3.tar.gz
starshatter-947910fc3c541ffdab3b042cfa3a3926b64f0ba3.tar.bz2
Streamlined instance management for Game and derived classes
Diffstat (limited to 'StarsEx/GameWinDX9.cpp')
-rw-r--r--StarsEx/GameWinDX9.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/StarsEx/GameWinDX9.cpp b/StarsEx/GameWinDX9.cpp
index 4b5b2d8..7099b90 100644
--- a/StarsEx/GameWinDX9.cpp
+++ b/StarsEx/GameWinDX9.cpp
@@ -24,7 +24,7 @@
#include "VideoSettings.h"
-GameWinDX9* GameWinDX9::instance = nullptr;
+GameWinDX9* GameWinDX9::instance {nullptr};
GameWinDX9*
@@ -56,7 +56,7 @@ GameWinDX9::GameWinDX9() :
is_device_restored {false}
{
if (instance != nullptr)
- Panic::Panic("Multiple instances of GameWinDX9");
+ throw "GameWinDX9 may have only one instance";
instance = this;
video_settings = new VideoSettings;
}
@@ -64,13 +64,13 @@ GameWinDX9::GameWinDX9() :
GameWinDX9::~GameWinDX9()
{
- if (instance != nullptr)
- instance = nullptr;
if (screen) delete screen;
if (video_factory) delete video_factory;
if (video) delete video;
if (soundcard) delete soundcard;
if (video_settings) delete video_settings;
+ if (instance == this)
+ instance = nullptr;
}