fix ThemeManager::HasMetric ignoring Fallback

This commit is contained in:
Glenn Maynard
2004-02-15 01:32:12 +00:00
parent 4c07cb1a4a
commit f6cf1f0b2e
2 changed files with 19 additions and 10 deletions
+18 -10
View File
@@ -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(),
+1
View File
@@ -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 );