From a9187f5ce4371fac408b84dadee82b5f174253da Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 7 Apr 2007 05:27:29 +0000 Subject: [PATCH] Store the group names in the map case insensitively. --- stepmania/src/SongManager.cpp | 9 +++++---- stepmania/src/SongManager.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index da54ef776d..07a43a101d 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -222,7 +222,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir, LoadingWindow *ld ) (sDir+sGroupDirName).c_str() ); int loaded = 0; - SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupDirName]; + SongPointerVector& index_entry = m_mapSongGroupIndex[istring(sGroupDirName)]; for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir { @@ -273,7 +273,7 @@ void SongManager::LoadGroupSymLinks(RString sDir, RString sGroupFolder) vector arraySymLinks; GetDirListing( sDir+sGroupFolder+"/*.include", arraySymLinks, false ); SortRStringArray( arraySymLinks ); - SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupFolder]; + SongPointerVector& index_entry = m_mapSongGroupIndex[istring(sGroupFolder)]; for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song. { MsdFile msdF; @@ -526,7 +526,7 @@ const vector &SongManager::GetSongs( const RString &sGroupName ) const if( sGroupName == GROUP_ALL ) return m_pSongs; - map::const_iterator iter = m_mapSongGroupIndex.find( sGroupName ); + map::const_iterator iter = m_mapSongGroupIndex.find( istring(sGroupName) ); if ( iter != m_mapSongGroupIndex.end() ) return iter->second; return vEmpty; @@ -1250,7 +1250,8 @@ Song *SongManager::FindSong( RString sPath ) Song *SongManager::FindSong( RString sGroup, RString sSong ) { // foreach song - FOREACH_CONST( Song*, m_pSongs, s ) + const vector &vSongs = GetSongs( sGroup.empty()? GROUP_ALL:sGroup ); + FOREACH_CONST( Song*, vSongs, s ) { if( (*s)->Matches(sGroup, sSong) ) return *s; diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index f50c11730f..2f882216be 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -19,6 +19,7 @@ struct lua_State; #include "Course.h" #include "ThemeMetric.h" #include "RageTexturePreloader.h" +#include "RageUtil.h" const int MAX_EDIT_STEPS_PER_PROFILE = 200; const int MAX_EDIT_COURSES_PER_PROFILE = 20; @@ -139,7 +140,7 @@ protected: vector m_vPreferredSongSort; vector m_sSongGroupNames; vector m_sSongGroupBannerPaths; // each song group may have a banner associated with it - map m_mapSongGroupIndex; + map m_mapSongGroupIndex; vector m_pCourses; vector m_pPopularCourses[NUM_ProfileSlot][NUM_CourseType];