diff --git a/src/include/video.h b/src/include/video.h index 9c86d6acba..3db4f1a05b 100644 --- a/src/include/video.h +++ b/src/include/video.h @@ -442,9 +442,6 @@ extern void DeInitImageLoaders(); /// initialize the video part extern void InitVideo(); -/// deinitliaize the video part -void DeInitVideo(); - /// Initializes video synchronization. extern void SetVideoSync(); diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp index 0313d774e8..c5b044db68 100644 --- a/src/stratagus/stratagus.cpp +++ b/src/stratagus/stratagus.cpp @@ -414,7 +414,7 @@ void Exit(int err) (SlowFrameCounter * 100) / (FrameCounter ? FrameCounter : 1)); lua_settop(Lua, 0); lua_close(Lua); - DeInitVideo(); + DeInitImageLoaders(); delete UnitManager; diff --git a/src/video/video.cpp b/src/video/video.cpp index f9a834feb3..e9ae1ed3f7 100644 --- a/src/video/video.cpp +++ b/src/video/video.cpp @@ -117,32 +117,22 @@ struct Clip { class CColorCycling { private: - CColorCycling() : ColorCycleAll(false), cycleCount(0) - {} + CColorCycling() {} - static void CreateInstanceIfNeeded() +public: + static CColorCycling &GetInstance() { - if (s_instance == nullptr) { - s_instance = new CColorCycling; - } + static CColorCycling s_instance; + return s_instance; } -public: - static CColorCycling &GetInstance() { CreateInstanceIfNeeded(); return *s_instance; } - - static void ReleaseInstance() { delete s_instance; s_instance = nullptr; } public: std::vector PaletteList; /// List of all used palettes. std::vector ColorIndexRanges; /// List of range of color index for cycling. - bool ColorCycleAll; /// Flag Color Cycle with all palettes - unsigned int cycleCount; -private: - static CColorCycling *s_instance; + bool ColorCycleAll = false; /// Flag Color Cycle with all palettes + unsigned int cycleCount = 0; }; - - - /*---------------------------------------------------------------------------- -- Externals ----------------------------------------------------------------------------*/ @@ -157,7 +147,6 @@ extern void SdlUnlockScreen(); /// Do SDL hardware unlock ----------------------------------------------------------------------------*/ CVideo Video; -/*static*/ CColorCycling *CColorCycling::s_instance = nullptr; char VideoForceFullScreen; /// fullscreen set from commandline @@ -348,11 +337,6 @@ void InitVideo() InitLineDraw(); } -void DeInitVideo() -{ - CColorCycling::ReleaseInstance(); -} - /** ** Set the video sync speed **