remove GetTapNoteX

This commit is contained in:
Glenn Maynard
2004-10-25 03:16:40 +00:00
parent c55dfd354f
commit f63c57b5f4
4 changed files with 16 additions and 22 deletions
+13 -13
View File
@@ -106,7 +106,7 @@ void NoteData::CopyAll( const NoteData& from )
bool NoteData::IsRowEmpty( int row ) const bool NoteData::IsRowEmpty( int row ) const
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNoteX(t, row).type != TapNote::empty ) if( GetTapNote(t, row).type != TapNote::empty )
return false; return false;
return true; return true;
} }
@@ -116,7 +116,7 @@ bool NoteData::IsRangeEmpty( int track, int rowBegin, int rowEnd ) const
ASSERT( track < GetNumTracks() ); ASSERT( track < GetNumTracks() );
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, track, r, rowBegin, rowEnd ) FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, track, r, rowBegin, rowEnd )
if( GetTapNoteX(track,r).type != TapNote::empty ) if( GetTapNote(track,r).type != TapNote::empty )
return false; return false;
return true; return true;
} }
@@ -141,7 +141,7 @@ bool NoteData::GetTapFirstNonEmptyTrack( int row, int &iNonEmptyTrackOut ) const
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( GetTapNoteX( t, row ).type != TapNote::empty ) if( GetTapNote( t, row ).type != TapNote::empty )
{ {
iNonEmptyTrackOut = t; iNonEmptyTrackOut = t;
return true; return true;
@@ -154,7 +154,7 @@ bool NoteData::GetTapFirstEmptyTrack( int row, int &iEmptyTrackOut ) const
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( GetTapNoteX( t, row ).type == TapNote::empty ) if( GetTapNote( t, row ).type == TapNote::empty )
{ {
iEmptyTrackOut = t; iEmptyTrackOut = t;
return true; return true;
@@ -167,7 +167,7 @@ bool NoteData::GetTapLastEmptyTrack( int row, int &iEmptyTrackOut ) const
{ {
for( int t=GetNumTracks()-1; t>=0; t-- ) for( int t=GetNumTracks()-1; t>=0; t-- )
{ {
if( GetTapNoteX( t, row ).type == TapNote::empty ) if( GetTapNote( t, row ).type == TapNote::empty )
{ {
iEmptyTrackOut = t; iEmptyTrackOut = t;
return true; return true;
@@ -181,7 +181,7 @@ int NoteData::GetNumTracksWithTap( int row ) const
int iNum = 0; int iNum = 0;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX( t, row ); const TapNote &tn = GetTapNote( t, row );
if( tn.type == TapNote::tap ) if( tn.type == TapNote::tap )
iNum++; iNum++;
} }
@@ -193,7 +193,7 @@ int NoteData::GetNumTracksWithTapOrHoldHead( int row ) const
int iNum = 0; int iNum = 0;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX( t, row ); const TapNote &tn = GetTapNote( t, row );
if( tn.type == TapNote::tap || tn.type == TapNote::hold_head ) if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
iNum++; iNum++;
} }
@@ -204,7 +204,7 @@ int NoteData::GetFirstTrackWithTap( int row ) const
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX( t, row ); const TapNote &tn = GetTapNote( t, row );
if( tn.type == TapNote::tap ) if( tn.type == TapNote::tap )
return t; return t;
} }
@@ -215,7 +215,7 @@ int NoteData::GetFirstTrackWithTapOrHoldHead( int row ) const
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX( t, row ); const TapNote &tn = GetTapNote( t, row );
if( tn.type == TapNote::tap || tn.type == TapNote::hold_head ) if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
return t; return t;
} }
@@ -366,7 +366,7 @@ int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const
{ {
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex ) FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{ {
const TapNote &tn = GetTapNoteX(t, r); const TapNote &tn = GetTapNote(t, r);
if( tn.type != TapNote::empty && tn.type != TapNote::mine ) if( tn.type != TapNote::empty && tn.type != TapNote::mine )
iNumNotes++; iNumNotes++;
} }
@@ -409,7 +409,7 @@ int NoteData::GetNumMines( float fStartBeat, float fEndBeat ) const
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex ) FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNoteX(t, r).type == TapNote::mine ) if( GetTapNote(t, r).type == TapNote::mine )
iNumMines++; iNumMines++;
} }
@@ -438,7 +438,7 @@ int NoteData::RowNeedsHands( const int row ) const
int iNumNotesThisIndex = 0; int iNumNotesThisIndex = 0;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX(t, row); const TapNote &tn = GetTapNote(t, row);
switch( tn.type ) switch( tn.type )
{ {
case TapNote::mine: case TapNote::mine:
@@ -514,7 +514,7 @@ int NoteData::GetNumN( int iMinTaps, float fStartBeat, float fEndBeat ) const
int iNumNotesThisIndex = 0; int iNumNotesThisIndex = 0;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
const TapNote &tn = GetTapNoteX(t, r); const TapNote &tn = GetTapNote(t, r);
if( tn.type != TapNote::mine && tn.type != TapNote::empty ) // mines don't count if( tn.type != TapNote::mine && tn.type != TapNote::empty ) // mines don't count
iNumNotesThisIndex++; iNumNotesThisIndex++;
} }
+1 -7
View File
@@ -41,15 +41,9 @@ public:
/* Return the note at the given track and row. Row may be out of /* Return the note at the given track and row. Row may be out of
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */ * range; pretend the song goes on with TAP_EMPTYs indefinitely. */
inline const TapNote &GetTapNote(unsigned track, int row) const
{
return GetTapNoteX( track, row );
}
void ReserveRows( int row ); void ReserveRows( int row );
/* GetTapNote is called a lot. This one doesn't do any bounds checking, inline const TapNote &GetTapNote(unsigned track, int row) const
* which is much faster. Be sure that 0 <= row < GetNumRows(). */
inline const TapNote &GetTapNoteX(unsigned track, int row) const
{ {
const TrackMap &mapTrack = m_TapNotes[track]; const TrackMap &mapTrack = m_TapNotes[track];
TrackMap::const_iterator iter = mapTrack.find( row ); TrackMap::const_iterator iter = mapTrack.find( row );
+1 -1
View File
@@ -142,7 +142,7 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
bool Missed = false; bool Missed = false;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
TapNote tn = GetTapNoteX(t, i); TapNote tn = GetTapNote(t, i);
if( tn.type == TapNote::empty ) if( tn.type == TapNote::empty )
continue; continue;
if( tn.type == TapNote::mine ) // mines don't count if( tn.type == TapNote::mine ) // mines don't count
+1 -1
View File
@@ -130,7 +130,7 @@ static StepsType DetermineStepsType( int iPlayer, const NoteData &nd )
{ {
for( int r=0; r<=iLastRow; r++ ) for( int r=0; r<=iLastRow; r++ )
{ {
if( nd.GetTapNoteX(t, r).type != TapNote::empty ) if( nd.GetTapNote(t, r).type != TapNote::empty )
{ {
bTrackHasNote[t] = true; bTrackHasNote[t] = true;
break; break;