From 51b9c3beecac8236aeafef1408784c6bca6c0457 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 25 Mar 2003 01:14:53 +0000 Subject: [PATCH] sort input clear input, so we don't accumulate if we load twice --- stepmania/src/LyricsLoader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stepmania/src/LyricsLoader.cpp b/stepmania/src/LyricsLoader.cpp index c1e71b2a35..684a51ecfb 100644 --- a/stepmania/src/LyricsLoader.cpp +++ b/stepmania/src/LyricsLoader.cpp @@ -13,6 +13,10 @@ #include using namespace std; +static int CompareLyricSegments(const LyricSegment &seg1, const LyricSegment &seg2) +{ + return seg1.m_fStartTime < seg2.m_fStartTime; +} bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out ) { @@ -29,6 +33,8 @@ bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out ) RageColor CurrentColor(0,1,0,1); + out.m_LyricSegments.clear(); + while(input.good() && getline(input, line)) { if(!line.compare(0, 2, "//")) @@ -83,6 +89,8 @@ bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out ) } + sort( out.m_LyricSegments.begin(), out.m_LyricSegments.end(), CompareLyricSegments ); + return true; }