infinite recursion checking

This commit is contained in:
Glenn Maynard
2004-03-20 10:24:42 +00:00
parent a692f2adfd
commit d66673fa6f
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -493,17 +493,18 @@ void ThemeManager::ReloadMetrics()
}
bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString &ret )
bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString &ret, int level )
{
CString sFallback;
if( level > 100 )
RageException::Throw("Infinite recursion looking up theme metric \"%s::%s\"", sClassName.c_str(), sValueName.c_str() );
// TODO: Add infinite recursion checking
CString sFallback;
if( m_pIniCurMetrics->GetValue(sClassName,sValueName,ret) )
return true;
if( m_pIniCurMetrics->GetValue(sClassName,"Fallback",sFallback) )
{
if( GetMetricRaw(sFallback,sValueName,ret) )
if( GetMetricRaw(sFallback,sValueName,ret,level+1) )
return true;
}
@@ -511,7 +512,7 @@ bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString
return true;
if( m_pIniBaseMetrics->GetValue(sClassName,"Fallback",sFallback) )
{
if( GetMetricRaw(sFallback,sValueName,ret) )
if( GetMetricRaw(sFallback,sValueName,ret,level+1) )
return true;
}
+1 -1
View File
@@ -66,7 +66,7 @@ public:
RageColor GetMetricC( CString sClassName, CString sValueName );
protected:
bool GetMetricRaw( CString sClassName, CString sValueName, CString &ret );
bool GetMetricRaw( CString sClassName, CString sValueName, CString &ret, int level=0 );
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 );