From 5873b47b19661d958fb8964af18123b12f39dc30 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 13 Jul 2003 00:02:23 +0000 Subject: [PATCH] Simplify. Fix metrics not reloading after the game's been running for a couple weeks. --- stepmania/src/ThemeManager.cpp | 9 +++------ stepmania/src/ThemeManager.h | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 5f32fd28cb..d6ce2d427e 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -43,9 +43,6 @@ ThemeManager::ThemeManager() { m_pIniMetrics = new IniFile; - /* Update the metric cache on the first call to GetMetric. */ - m_fNextReloadTicks = 0; - m_sCurThemeName = BASE_THEME_NAME; // Use the base theme for now. It's up to PrefsManager to change this. m_uHashForCurThemeMetrics = m_uHashForBaseThemeMetrics = 0; @@ -292,10 +289,10 @@ try_metric_again: CString sDefaultMetricPath = GetMetricsPathFromName(BASE_THEME_NAME); // Is our metric cache out of date? - // XXX: GTSS wraps every ~40 days. Need a better way to handler timers like this. - if (RageTimer::GetTimeSinceStart() >= m_fNextReloadTicks) + if ( !m_uHashForBaseThemeMetrics || m_ReloadTimer.PeekDeltaTime() >= 1 ) { - m_fNextReloadTicks = RageTimer::GetTimeSinceStart()+1.0f; + m_ReloadTimer.GetDeltaTime(); + if( m_uHashForCurThemeMetrics != GetHashForFile(sCurMetricPath) || m_uHashForBaseThemeMetrics != GetHashForFile(sDefaultMetricPath) ) { diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index bb4358fe96..74d459dfd5 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -13,6 +13,7 @@ */ #include "RageTypes.h" +#include "RageTimer.h" class IniFile; @@ -55,9 +56,9 @@ protected: CString m_sCurThemeName; IniFile* m_pIniMetrics; // make this a pointer so we don't have to include IniFile in this header! - float m_fNextReloadTicks; unsigned m_uHashForCurThemeMetrics; unsigned m_uHashForBaseThemeMetrics; + RageTimer m_ReloadTimer; }; extern ThemeManager* THEME; // global and accessable from anywhere in our program