From 6bfccc7f4c5cdc9dc48ef661e2f0e8be0a4c3c73 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Wed, 16 Aug 2006 11:57:24 +0000 Subject: [PATCH] Remove IteratorCondition, use NULL to signify what was previously IteratorCondition::All. --- stepmania/src/NoteData.cpp | 37 ++----------------------------------- stepmania/src/NoteData.h | 14 ++------------ 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 2d3daab1fe..3e395c80cc 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -14,39 +14,6 @@ #include "RageUtil_AutoPtr.h" REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) ) -bool IteratorCondition::TapsHoldsAndMines( const TapNote &tn ) -{ - switch( tn.type ) - { - case TapNote::tap: - case TapNote::hold_head: - case TapNote::mine: - return true; - } - return false; -} - -bool IteratorCondition::TapsAndHolds( const TapNote &tn ) -{ - switch( tn.type ) - { - case TapNote::tap: - case TapNote::hold_head: - return true; - } - return false; -} - -bool IteratorCondition::Mines( const TapNote &tn ) -{ - return tn.type == TapNote::mine; -} - -bool IteratorCondition::All( const TapNote &tn ) -{ - return true; -} - NoteData::NoteData() { Init(); @@ -927,7 +894,7 @@ XNode* NoteData::CreateNode() const XNode *p = new XNode; p->m_sName = "NoteData"; - all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow(), IteratorCondition::All ); + all_tracks_const_iterator iter = GetTapNoteRangeAllTracks( 0, GetLastRow() ); for( ; !iter.IsAtEnd(); ++iter ) { @@ -970,7 +937,7 @@ void NoteData::_all_tracks_iterator::Find() { m_Iterator = m_NoteData.FindTapNote( m_iTrack, m_iRow ); - if( m_Iterator != m_NoteData.end(m_iTrack) && m_Cond(m_Iterator->second) ) + if( m_Iterator != m_NoteData.end(m_iTrack) && (!m_Cond || m_Cond(m_Iterator->second)) ) return; ++m_iTrack; } diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 8f74a34975..668398497c 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -19,14 +19,6 @@ #define FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( nd, row, start, last ) \ for( int row = start-1; (nd).GetNextTapNoteRowForAllTracks(row) && row < (last); ) -namespace IteratorCondition -{ - bool TapsHoldsAndMines( const TapNote &tn ); - bool TapsAndHolds( const TapNote &tn ); - bool Mines( const TapNote &tn ); - bool All( const TapNote &tn ); -} - class NoteData { public: @@ -101,13 +93,11 @@ public: /* Return an iterator range including exactly iStartRow to iEndRow. */ void GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, const_iterator &begin, const_iterator &end ) const; void GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end ); - all_tracks_iterator GetTapNoteRangeAllTracks( int iStartRow, int iEndRow, - IteratorCond cond = IteratorCondition::TapsHoldsAndMines ) + all_tracks_iterator GetTapNoteRangeAllTracks( int iStartRow, int iEndRow, IteratorCond cond = NULL ) { return all_tracks_iterator( *this, iStartRow, iEndRow, cond ); } - all_tracks_const_iterator GetTapNoteRangeAllTracks( int iStartRow, int iEndRow, - IteratorCond cond = IteratorCondition::TapsHoldsAndMines ) const + all_tracks_const_iterator GetTapNoteRangeAllTracks( int iStartRow, int iEndRow, IteratorCond cond = NULL) const { return all_tracks_const_iterator( *this, iStartRow, iEndRow, cond ); }