From deff9d054be94dc3373f44e3d3bc94062be10065 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 26 Apr 2020 03:05:18 -0400 Subject: [PATCH] CTimeProvider: Move global instance to cpp file This isn't used anywhere externally, so we can keep it hidden in the cpp file. --- Runtime/CTimeProvider.cpp | 21 ++++++++++++--------- Runtime/CTimeProvider.hpp | 2 -- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Runtime/CTimeProvider.cpp b/Runtime/CTimeProvider.cpp index b5e60e58d..b8bceabb5 100644 --- a/Runtime/CTimeProvider.cpp +++ b/Runtime/CTimeProvider.cpp @@ -3,21 +3,24 @@ #include "Runtime/Graphics/CGraphics.hpp" namespace urde { -CTimeProvider* CTimeProvider::g_currentTimeProvider = nullptr; -CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(g_currentTimeProvider) { - if (x8_lastProvider != nullptr) - x8_lastProvider->x4_first = false; +static CTimeProvider* s_currentTimeProvider = nullptr; - g_currentTimeProvider = this; +CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(s_currentTimeProvider) { + if (x8_lastProvider != nullptr) { + x8_lastProvider->x4_first = false; + } + + s_currentTimeProvider = this; CGraphics::SetExternalTimeProvider(this); } CTimeProvider::~CTimeProvider() { - g_currentTimeProvider = x8_lastProvider; - if (g_currentTimeProvider) - g_currentTimeProvider->x4_first = true; - CGraphics::SetExternalTimeProvider(g_currentTimeProvider); + s_currentTimeProvider = x8_lastProvider; + if (s_currentTimeProvider != nullptr) { + s_currentTimeProvider->x4_first = true; + } + CGraphics::SetExternalTimeProvider(s_currentTimeProvider); } } // namespace urde diff --git a/Runtime/CTimeProvider.hpp b/Runtime/CTimeProvider.hpp index d710108b8..af99cb2bf 100644 --- a/Runtime/CTimeProvider.hpp +++ b/Runtime/CTimeProvider.hpp @@ -1,9 +1,7 @@ #pragma once namespace urde { -class CTimeProvider; class CTimeProvider { public: - static CTimeProvider* g_currentTimeProvider; const float& x0_currentTime; // in seconds bool x4_first = true; CTimeProvider* x8_lastProvider = nullptr;