From 8efe6ee455e97b61b90d4ccdd8238d9a6a0ce0f9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 2 Nov 2002 22:53:04 +0000 Subject: [PATCH] use GetHoldNote --- stepmania/src/NoteData.cpp | 35 ++++++++++++++++++----------------- stepmania/src/NoteData.h | 7 ++++--- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index c9ba543367..7aebc9e6ca 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -224,7 +224,7 @@ void NoteData::AddHoldNote( HoldNote add ) // Rework this later. for( i=0; i= 0 && iHoldIndex < m_iNumHoldNotes ); - HoldNote& hn = m_HoldNotes[iHoldIndex]; + HoldNote& hn = GetHoldNote(iHoldIndex); int iHoldStartIndex = BeatToNoteRow(hn.m_fStartBeat); @@ -287,7 +287,7 @@ bool NoteData::IsThereANoteAtRow( int iRow ) const // There is a tap note at the beginning of every HoldNote start // // for( int i=0; i fOldestBeatFoundSoFar ) - fOldestBeatFoundSoFar = m_HoldNotes[i].m_fEndBeat; + if( GetHoldNote(i).m_fEndBeat > fOldestBeatFoundSoFar ) + fOldestBeatFoundSoFar = GetHoldNote(i).m_fEndBeat; } return fOldestBeatFoundSoFar; @@ -399,7 +399,7 @@ int NoteData::GetNumHoldNotes( const float fStartBeat, const float fEndBeat ) for( int i=0; i= iFirstRightSideColumn ) { // delete this HoldNote by shifting everything down + // XXX: err, why not just call RemoveHoldNote? for( int j=i; j=0; i-- ) // foreach HoldNote { - HoldNote &hn = m_HoldNotes[i]; + HoldNote &hn = GetHoldNote(i); if( hn.m_iTrack < iFirstRightSideColumn ) { @@ -484,7 +485,7 @@ void NoteData::CropToRightSide() } else { - m_HoldNotes[i].m_iTrack -= 4; + hn.m_iTrack -= 4; } } } @@ -494,7 +495,7 @@ void NoteData::RemoveHoldNotes() // turn all the HoldNotes into TapNotes for( int i=0; im_iNumHoldNotes; i++ ) - tempNoteData.AddHoldNote( this->m_HoldNotes[i] ); + tempNoteData.AddHoldNote( this->GetHoldNote(i) ); this->ConvertHoldNotesTo4s(); @@ -730,7 +731,7 @@ void NoteData::ConvertHoldNotesTo2sAnd3s() // copy HoldNotes into the new structure, but expand them into 2s and 3s for( int i=0; iConvert4sToHoldNotes(); for( int i=0; im_iNumHoldNotes; i++ ) { - const HoldNote& hn = pOriginal->m_HoldNotes[i]; + const HoldNote& hn = pOriginal->GEtHoldNote(i); /* Bug here: NoteRowToBeat() may have floating point error, * so we need to do an epsilon here. But we can do this in - * 4s easier anyway ... */ + * 4s easier anyway ... XXX -glenn */ if( hn.m_fStartBeat < NoteRowToBeat(r) && hn.m_fEndBeat > NoteRowToBeat(r) ) { bHoldCrossesThisMeasure = true; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 62dd9d4963..20f63441b2 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -72,7 +72,6 @@ public: void RemoveHoldNote( int index ); HoldNote &GetHoldNote( int index ) { return m_HoldNotes[index]; } const HoldNote &GetHoldNote( int index ) const { return m_HoldNotes[index]; } - const int GetNumHoldNotes() const { return m_iNumHoldNotes; } // statistics bool IsThereANoteAtRow( int iRow ) const; @@ -83,8 +82,10 @@ public: int GetLastRow(); int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); - int GetNumHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); - + /* optimization: for the default of start to end, use the second (faster) */ + int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = MAX_BEATS ); + int GetNumHoldNotes() const { return m_iNumHoldNotes; } + int GetPossibleDancePoints(); // radar values - return between 0.0 and 1.2