From 10a4f13c513f680fdad39b217343aa0013dfc324 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 12 Feb 2005 08:16:02 +0000 Subject: [PATCH] move InsertHoldTails into NoteDataUtil --- stepmania/src/NoteDataUtil.cpp | 35 ++++++++++++++++------------------ stepmania/src/NoteDataUtil.h | 1 + 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 638e0e864d..240a12e5ee 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -227,33 +227,30 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData } } -namespace +void NoteDataUtil::InsertHoldTails( NoteData &inout ) { - void InsertHoldTails( NoteData &inout ) + for( int t=0; t < inout.GetNumTracks(); t++ ) { - for( int t=0; t < inout.GetNumTracks(); t++ ) + NoteData::iterator begin = inout.begin(t), end = inout.end(t); + + for( ; begin != end; ++begin ) { - NoteData::iterator begin = inout.begin(t), end = inout.end(t); + int iRow = begin->first; + const TapNote &tn = begin->second; + if( tn.type != TapNote::hold_head ) + continue; - for( ; begin != end; ++begin ) - { - int iRow = begin->first; - const TapNote &tn = begin->second; - if( tn.type != TapNote::hold_head ) - continue; + TapNote tail = tn; + tail.type = TapNote::hold_tail; - TapNote tail = tn; - tail.type = TapNote::hold_tail; + /* If iDuration is 0, we'd end up overwriting the head with the tail + * (and invalidating our iterator). Empty hold notes aren't valid. */ + ASSERT( tn.iDuration != 0 ); - /* If iDuration is 0, we'd end up overwriting the head with the tail - * (and invalidating our iterator). Empty hold notes aren't valid. */ - ASSERT( tn.iDuration != 0 ); - - inout.SetTapNote( t, iRow + tn.iDuration, tail ); - } + inout.SetTapNote( t, iRow + tn.iDuration, tail ); } } -}; +} void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString ¬es_out ) { diff --git a/stepmania/src/NoteDataUtil.h b/stepmania/src/NoteDataUtil.h index 8f9013be80..1cddc20c04 100644 --- a/stepmania/src/NoteDataUtil.h +++ b/stepmania/src/NoteDataUtil.h @@ -22,6 +22,7 @@ namespace NoteDataUtil void LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks ); void LoadOverlapped( const NoteData &in, NoteData &out, int iNewNumTracks ); void LoadTransformedLights( const NoteData &in, NoteData &out, int iNewNumTracks ); + void InsertHoldTails( NoteData &inout ); // radar values - return between 0.0 and 1.2 float GetStreamRadarValue( const NoteData &in, float fSongSeconds );