diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 0597b57e1c..af8ab201e1 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -455,7 +455,7 @@ CString ThemeManager::GetMetricsIniPath( CString sThemeName ) bool ThemeManager::HasMetric( CString sClassName, CString sValueName ) { CString sThrowAway; - return m_pIniMetrics->GetValue(sClassName,sValueName,sThrowAway); + return GetMetricRaw( sClassName, sValueName, sThrowAway ); } void ThemeManager::ReloadMetricsIfNecessary() @@ -487,20 +487,25 @@ void ThemeManager::ReloadMetrics() } +bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString &ret ) +{ + if( m_pIniMetrics->GetValue(sClassName,sValueName,ret) ) + return true; + + CString sFallback; + if( m_pIniMetrics->GetValue(sClassName,"Fallback",sFallback) ) + return GetMetricRaw( sFallback, sValueName, ret ); + return false; +} + CString ThemeManager::GetMetricRaw( CString sClassName, CString sValueName ) { try_metric_again: - CString sCurMetricPath = GetMetricsIniPath(m_sCurThemeName); - CString sDefaultMetricPath = GetMetricsIniPath(BASE_THEME_NAME); + CString ret; + if( ThemeManager::GetMetricRaw( sClassName, sValueName, ret ) ) + return ret; - CString sValue; - if( m_pIniMetrics->GetValue(sClassName,sValueName,sValue) ) - return sValue; - - CString sFallback; - if( m_pIniMetrics->GetValue(sClassName,"Fallback",sFallback) ) - return GetMetricRaw( sFallback, sValueName ); CString sMessage = ssprintf( "The theme metric '%s-%s' is missing. Correct this and click Retry, or Cancel to break.",sClassName.c_str(),sValueName.c_str() ); switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage) ) @@ -517,6 +522,9 @@ try_metric_again: ASSERT(0); } + CString sCurMetricPath = GetMetricsIniPath(m_sCurThemeName); + CString sDefaultMetricPath = GetMetricsIniPath(BASE_THEME_NAME); + RageException::Throw( "Theme metric '%s : %s' could not be found in '%s' or '%s'.", sClassName.c_str(), sValueName.c_str(), diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index c9eeeabe27..cc2e8f4e05 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -66,6 +66,7 @@ public: RageColor GetMetricC( CString sClassName, CString sValueName ); protected: + bool GetMetricRaw( CString sClassName, CString sValueName, CString &ret ); CString GetPathToAndFallback( CString sThemeName, ElementCategory category, CString sClassName, CString sFile ); CString GetPathToRaw( CString sThemeName, ElementCategory category, CString sClassName, CString sFile ); static CString GetThemeDirFromName( const CString &sThemeName );