From 49471824874cbc6f32e53fa587d093633de8436e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 5 Feb 2003 20:00:49 +0000 Subject: [PATCH] for courses, first try to match descriptions, then difficulties --- stepmania/src/Course.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index d3aa0e9233..1b7861b87c 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -224,15 +224,29 @@ Notes* Course::GetNotesForStage( int iStage ) Song* pSong = GetSong(iStage); CString sDescription = entries[iStage].description; - for( unsigned i=0; im_apNotes.size(); i++ ) + /* First, search for an exact description match. */ + unsigned i; + for( i=0; im_apNotes.size(); i++ ) { Notes* pNotes = pSong->m_apNotes[i]; if( !GAMESTATE->GetCurrentStyleDef()->MatchesNotesType(pNotes->m_NotesType) ) continue; - if( !pNotes->GetDescription().CompareNoCase(sDescription) || - !DifficultyToString(pNotes->GetDifficulty()).CompareNoCase(sDescription) ) + if( !pNotes->GetDescription().CompareNoCase(sDescription) ) + return pNotes; + } + + /* If that failed, try to do a difficulty match. */ + Difficulty dc = StringToDifficulty(sDescription); + for( i=0; i < pSong->m_apNotes.size(); i++ ) + { + Notes* pNotes = pSong->m_apNotes[i]; + + if( !GAMESTATE->GetCurrentStyleDef()->MatchesNotesType(pNotes->m_NotesType) ) + continue; + + if(dc == pNotes->GetDifficulty()) return pNotes; }