From 7cf3351851da578f95a8412cf04034d9be99bf3f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 23 Jan 2005 05:31:55 +0000 Subject: [PATCH] implement NoteDataUtil::ClearLeft and NoteDataUtil::ClearRight without 4s --- stepmania/src/NoteData.cpp | 32 ++++++++++++++++++++++++++------ stepmania/src/NoteData.h | 1 + stepmania/src/NoteDataUtil.cpp | 15 +++++---------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index dd6944a298..b4e8ccfb6f 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -40,12 +40,29 @@ void NoteData::SetNumTracks( int iNewNumTracks ) /* Clear [rowBegin,rowEnd]; that is, including rowEnd. */ -void NoteData::ClearRange( int rowBegin, int rowEnd ) +void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack ) { + /* Optimization: if the range encloses everything, just clear the whole maps. */ + if( rowBegin == 0 && rowEnd == MAX_NOTE_ROW ) + { + m_TapNotes[iTrack].clear(); + + for( int i = GetNumHoldNotes()-1; i >= 0; --i ) + { + HoldNote hn = GetHoldNote(i); + if( hn.iTrack != iTrack ) + continue; + this->RemoveHoldNote( i ); + } + } + /* Crop or split hold notes overlapping the range. */ for( int i = GetNumHoldNotes()-1; i >= 0; --i ) // for each HoldNote { HoldNote hn = GetHoldNote(i); + if( hn.iTrack != iTrack ) + continue; + if( !hn.RangeOverlaps(rowBegin, rowEnd) ) continue; @@ -74,11 +91,14 @@ void NoteData::ClearRange( int rowBegin, int rowEnd ) } /* Clear other notes in the region. */ - for( int t=0; t 0 ); ASSERT( iStartIndex < iEndIndex ); ASSERT( iStartIndex >= 0 );