From b6df02af4cd4f36d0a37ea5ebaf330b83d4cf1bf Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 31 Oct 2005 00:32:30 +0000 Subject: [PATCH] Cannot use FOREACH here since --song is not valid for the first element. --- stepmania/src/Course.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 7f9218b0df..a22c5ddb12 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -517,26 +517,23 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) SONGMAN->GetSongs(vpAllPossibleSongs, 1); // remove locked and tutorial songs from the list - FOREACH( Song*, vpAllPossibleSongs, song ) + for( vector::iterator song = vpAllPossibleSongs.begin(); song != vpAllPossibleSongs.end(); ) { // Ignore locked songs when choosing randomly // TODO: Move Course initialization after UNLOCKMAN is created if( UNLOCKMAN && UNLOCKMAN->SongIsLocked(*song) ) { - vector::iterator eraseme = song; - song--; - vpAllPossibleSongs.erase( eraseme ); + song = vpAllPossibleSongs.erase( song ); continue; } // Ignore boring tutorial songs if( (*song)->IsTutorial() ) { - vector::iterator eraseme = song; - song--; - vpAllPossibleSongs.erase( eraseme ); + song = vpAllPossibleSongs.erase( song ); continue; } + ++song; } // Resolve each entry to a Song and Steps. @@ -558,13 +555,9 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) // Choose an exact song, if we have matching steps and all e->pSong->GetSteps( vpPossibleSteps, st, e->baseDifficulty, e->iLowMeter, e->iHighMeter ); if( !vpPossibleSteps.empty() ) - { pResolvedSong = e->pSong; - } else - { continue; - } } else {