diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp index cddeb1b796..4e181c0427 100644 --- a/stepmania/src/CommonMetrics.cpp +++ b/stepmania/src/CommonMetrics.cpp @@ -9,7 +9,7 @@ CString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%d",int(p+1)); } -ThemeMetric INITIAL_SCREEN ("Common","InitialScreen"); +ThemeMetric INITIAL_SCREEN ("Common","InitialScreen", true); // always reevaluate metric ThemeMetric FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen"); ThemeMetric DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); ThemeMetric DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" ); diff --git a/stepmania/src/ThemeMetric.h b/stepmania/src/ThemeMetric.h index 5ca6444e9c..8be25d9819 100644 --- a/stepmania/src/ThemeMetric.h +++ b/stepmania/src/ThemeMetric.h @@ -24,15 +24,21 @@ private: T m_currentValue; bool m_bIsLoaded; + /* HACK: If true, reload the metric each time it's read. This is like DynamicThemeMetric, + * but works transparently for strings. This is very slow, and should be removed once + * metrics are refactored to fix DynamicThemeMetric. */ + bool m_bAlwaysReload; + public: /* Initializing with no group and name is allowed; if you do this, you must * call Load() to set them. This is done to allow initializing cached metrics * in one place for classes that don't receive their m_sName in the constructor * (everything except screens). */ - ThemeMetric( const CString& sGroup = "", const CString& sName = "" ): + ThemeMetric( const CString& sGroup = "", const CString& sName = "", bool bAlwaysReload = false ): m_sGroup( sGroup ), m_sName( sName ), - m_bIsLoaded( false ) + m_bIsLoaded( false ), + m_bAlwaysReload( bAlwaysReload ) { m_currentValue = T(); ThemeManager::Subscribe( this ); @@ -43,7 +49,8 @@ public: m_sGroup( cpy.m_sGroup ), m_sName( cpy.m_sName ), m_currentValue( cpy.m_currentValue ), - m_bIsLoaded( cpy.m_bIsLoaded ) + m_bIsLoaded( cpy.m_bIsLoaded ), + m_bAlwaysReload( cpy.m_bAlwaysReload ) { ThemeManager::Subscribe( this ); } @@ -80,6 +87,12 @@ public: ASSERT( m_sName != "" ); ASSERT( m_bIsLoaded ); + if( m_bAlwaysReload ) + { + ThemeMetric *p = const_cast *>(this); + p->Read(); + } + return m_currentValue; }