fix RemoveSimultaneousNotes never removes hold notes

This commit is contained in:
Glenn Maynard
2006-04-14 12:44:34 +00:00
parent fad6a6e4c1
commit 5f3fe4ec4f
+6 -11
View File
@@ -703,7 +703,11 @@ void NoteDataUtil::ChangeRollsToHolds( NoteData &in, int iStartIndex, int iEndIn
void NoteDataUtil::RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous, int iStartIndex, int iEndIndex ) void NoteDataUtil::RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous, int iStartIndex, int iEndIndex )
{ {
// turn all the HoldNotes into TapNotes // Remove tap and hold notes so no more than iMaxSimultaneous buttons are being held at any
// given time. Never touch data outside of the range given; if many hold notes are overlapping
// iStartIndex, and we'd have to change those holds to obey iMaxSimultaneous, just do the best
// we can without doing so.
notes to turn all the HoldNotes into TapNotes
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartIndex, iEndIndex ) FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartIndex, iEndIndex )
{ {
set<int> viTracksHeld; set<int> viTracksHeld;
@@ -715,20 +719,11 @@ void NoteDataUtil::RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous,
for( int t=0; iTracksToRemove>0 && t<in.GetNumTracks(); t++ ) for( int t=0; iTracksToRemove>0 && t<in.GetNumTracks(); t++ )
{ {
const TapNote &tn = in.GetTapNote(t,r); const TapNote &tn = in.GetTapNote(t,r);
if( tn.type == TapNote::tap ) if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
{ {
in.SetTapNote( t, r, TAP_EMPTY ); in.SetTapNote( t, r, TAP_EMPTY );
iTracksToRemove--; iTracksToRemove--;
} }
else if( tn.type == TapNote::hold_head )
{
int iStartTrack;
if( !in.IsHoldNoteAtRow( t, r, &iStartTrack ) )
continue;
in.SetTapNote( t, iStartTrack, TAP_EMPTY );
iTracksToRemove--;
}
} }
} }
} }