From 10bc0bf336cc651ac5322fb24eebd15330d73331 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 7 Feb 2005 21:55:43 +0000 Subject: [PATCH] remove NoteData::RemoveHoldTails cleanup --- stepmania/src/NoteData.cpp | 49 +++++--------------------------------- stepmania/src/NoteData.h | 1 - 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 035fdc0d1f..690fd2bc1a 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -816,8 +816,7 @@ void NoteData::InsertHoldTails() { for( int t=0; tbegin(t), end = this->end(t); for( ; begin != end; ++begin ) { @@ -828,52 +827,16 @@ void NoteData::InsertHoldTails() 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 ); + SetTapNote( t, iRow + tn.iDuration, tail ); } } } -void NoteData::RemoveHoldTails() -{ - for( int t=0; tfirst; - const TapNote &tn = begin->second; - if( tn.type != TapNote::hold_head ) - continue; - - /* Search forward until we find a hold_tail. */ - iterator tail = begin; - - while( tail != end && tail->second.type != TapNote::hold_tail ) - ++tail; - - if( tail == end ) - { - /* If we didn't find one, the hold is invalid; delete it. */ - RemoveTapNote( t, begin ); - } - else - { - /* Delete the tail, and update iDuration of the head. */ - if( next == tail ) - ++next; - int iEndRow = tail->first; - begin->second.iDuration = iEndRow - iStartRow; - RemoveTapNote( t, tail ); - } - } - } -} - /* * (c) 2001-2004 Chris Danford, Glenn Maynard * All rights reserved. diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 0cad53c22b..97e5362a32 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -144,7 +144,6 @@ public: /* hold_tail is only used to make SM parsing easier. */ void InsertHoldTails(); - void RemoveHoldTails(); /* adjusts iDuration */ };