From b8e01d8164e4fec2217021508e7393a6838fda20 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 19 May 2002 06:13:16 +0000 Subject: [PATCH] no message --- stepmania/src/RageUtil.cpp | 13 +- stepmania/src/RageUtil.h | 2 +- stepmania/src/ThemeManager.cpp | 356 +++++++++++++++++++-------------- stepmania/src/ThemeManager.h | 1 - 4 files changed, 215 insertions(+), 157 deletions(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 1470e96187..e28b83bb11 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -251,8 +251,11 @@ void splitrelpath( const CString &Path, CString& Dir, CString& FName, CString& E } -void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs ) +void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo ) { + CString sDir, sThrowAway; + splitrelpath( sPath, sDir, sThrowAway, sThrowAway ); + WIN32_FIND_DATA fd; HANDLE hFind = ::FindFirstFile( sPath, &fd ); @@ -268,8 +271,12 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs ) if( sDirName == "." || sDirName == ".." ) continue; - - AddTo.Add( sDirName ); + + if( bReturnPathToo ) + AddTo.Add( sDir + sDirName ); + else + AddTo.Add( sDirName ); + } while( ::FindNextFile( hFind, &fd ) ); ::FindClose( hFind ); diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index dbae1dcd49..4d821557f9 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -96,7 +96,7 @@ CString join( const CStringArray& Source ); -void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false ); +void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false, bool bReturnPathToo=false ); ULONG GetHashForString( CString s ); ULONG GetHashForFile( CString sPath ); ULONG GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 58dc4743ac..df569f1f64 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -19,7 +19,7 @@ ThemeManager* THEME = NULL; // global object accessable from anywhere in the pro const CString DEFAULT_THEME_NAME = "default"; -const CString THEME_BASE_DIR = "Themes\\default\\"; +const CString THEME_BASE_DIR = "Themes\\"; ThemeManager::ThemeManager() { @@ -45,180 +45,232 @@ void ThemeManager::GetThemeNames( CStringArray& AddTo ) void ThemeManager::SwitchTheme( CString sThemeName ) { - CString sThemeDir = GetThemeDirFromName( m_sCurThemeName ); - + m_sCurThemeName = sThemeName; + CString sThemeDir = GetThemeDirFromName(m_sCurThemeName); if( !DoesFileExist( sThemeDir ) ) - FatalError( "Error loading the announcer in diretory '%s'.", m_sCurThemeName ); + FatalError( "Error loading the theme in diretory '%s'.", sThemeDir ); } void ThemeManager::AssertThemeIsComplete( CString sAnnouncerName ) { - for( int i=0; i 0 ) + return asPossibleElementFilePaths[0]; + else + FatalError( "Theme element '%s' could not be found in '%s' or '%s'.", + sDefaultThemeDir + sAssetPrefix, + GetThemeDirFromName(m_sCurThemeName), + GetThemeDirFromName(DEFAULT_THEME_NAME) ); + + return ""; } diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index 7a7b35f50c..9b7fe4be32 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -169,7 +169,6 @@ public: void SwitchTheme( CString sThemeName ); // return false if theme doesn't exist void AssertThemeIsComplete( CString sThemeName ); // return false if theme doesn't exist CString GetPathTo( ThemeElement te ); - CString GetPathTo( ThemeElement te, CString sThemeName ); protected: CString GetThemeDirFromName( CString sAnnouncerName );