From 1092237cb02b772f21563cab112b8583d12dd708 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 14 Jun 2006 09:16:28 +0000 Subject: [PATCH] don't choose the same song for 2 TrailEntries in a row --- stepmania/src/Course.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 865e0960a9..d38bb8a4bc 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -525,6 +525,19 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) vpPossibleSongs.push_back( *song ); } + // It looks bad to have the same song 2x in a row in a randomly generated course. + // Don't allow the same song to be played 2x in a row, unless there's only + // one song in vpPossibleSongs. + if( trail.m_vEntries.size() > 0 && vpPossibleSongs.size() > 1 ) + { + const TrailEntry &teLast = trail.m_vEntries[trail.m_vEntries.size()-1]; + for( int i=vpPossibleSongs.size()-1; i>=0; i-- ) + { + if( vpPossibleSongs[i] == teLast.pSong ) + vpPossibleSongs.erase( vpPossibleSongs.begin()+i ); + } + } + // if there are no songs to choose from, abort now if( vpPossibleSongs.empty() ) continue;