From 68cb6139026d7e68ab26b49910efc7727b87f601 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 2 Nov 2002 23:10:38 +0000 Subject: [PATCH] make HoldNotes a vector --- stepmania/src/NoteData.cpp | 36 +++++++++++++----------------------- stepmania/src/NoteData.h | 7 +++---- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 811e1ef617..5c9b19c470 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -36,19 +36,18 @@ NoteData::NoteData(const NoteData &cpy) NoteData &NoteData::operator= (const NoteData &cpy) { Init(); + for(int t = 0; t < MAX_NOTE_TRACKS; ++t) m_TapNotes[t] = cpy.m_TapNotes[t]; - memmove(m_HoldNotes, cpy.m_HoldNotes, sizeof(m_HoldNotes)); m_iNumTracks = cpy.m_iNumTracks; - m_iNumHoldNotes = cpy.m_iNumHoldNotes; + m_HoldNotes = cpy.m_HoldNotes; return *this; } void NoteData::Init() { m_iNumTracks = 0; - m_iNumHoldNotes = 0; } NoteData::~NoteData() @@ -239,10 +238,7 @@ void NoteData::AddHoldNote( HoldNote add ) add.m_fEndBeat = max(add.m_fEndBeat, other.m_fEndBeat); // delete this HoldNote - for( int j=i; j= 0 && iHoldIndex < m_iNumHoldNotes ); + ASSERT( iHoldIndex >= 0 && iHoldIndex < GetNumHoldNotes() ); HoldNote& hn = GetHoldNote(iHoldIndex); @@ -272,10 +268,7 @@ void NoteData::RemoveHoldNote( int iHoldIndex ) SetTapNote(hn.m_iTrack, iHoldStartIndex, TAP_EMPTY); // remove from list - for( int j=iHoldIndex; j= iFirstRightSideColumn ) { - // delete this HoldNote by shifting everything down - // XXX: err, why not just call RemoveHoldNote? - for( int j=i; j m_HoldNotes; /* Return the note at the given track and row. Row may be out of * range; pretend the song goes on with TAP_EMPTYs indefinitely. */ @@ -57,7 +56,7 @@ public: void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd ); void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); }; void CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = -1 ); - void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_iNumHoldNotes = 0; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; + void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_HoldNotes.clear(); CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; inline bool IsRowEmpty( int index ) { @@ -84,7 +83,7 @@ public: int GetNumDoubles( 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 GetNumHoldNotes() const { return m_HoldNotes.size(); } int GetPossibleDancePoints();