From 5a602a6fa2c305369e30cc6baafc50162fd7f454 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 28 Apr 2007 08:59:00 +0000 Subject: [PATCH] Compute the file path cache one time. --- stepmania/src/Song.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index f3b4abce34..3f53b93b21 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -199,7 +199,9 @@ bool Song::LoadFromSongDir( RString sDir ) // unsigned uCacheHash = SONGINDEX->GetCacheHash(m_sSongDir); bool bUseCache = true; - if( !DoesFileExist(GetCacheFilePath()) ) + const RString sCacheFilePath = GetCacheFilePath(); + + if( !DoesFileExist(sCacheFilePath) ) bUseCache = false; if( !PREFSMAN->m_bFastLoad && GetHashForDirectory(m_sSongDir) != uCacheHash ) bUseCache = false; // this cache is out of date @@ -207,7 +209,7 @@ bool Song::LoadFromSongDir( RString sDir ) if( bUseCache ) { // LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.c_str(), GetCacheFilePath().c_str() ); - SMLoader::LoadFromSMFile( GetCacheFilePath(), *this, true ); + SMLoader::LoadFromSMFile( sCacheFilePath, *this, true ); SMLoader::TidyUpData( *this, true ); } else @@ -243,7 +245,7 @@ bool Song::LoadFromSongDir( RString sDir ) FOREACH( Steps*, m_vpSteps, s ) { - (*s)->SetFilename( GetCacheFilePath() ); + (*s)->SetFilename( sCacheFilePath ); /* Compress all Steps. During initial caching, this will remove cached NoteData; * during cached loads, this will just remove cached SMData. */