Add MAX_NOTE_ROW, indicating the maximum row that we can represent.
We can actually go much higher; I set this to 1<<30 instead of 1<<31 so we don't overflow when eg. adding one beat or one measure in some algorithms. The advantage of this over "999999" is it won't break if ROWS_PER_BEAT is changed to a large value. Also, since this value will typically be much larger than any actual row, it'll quickly show up any algorithms that aren't iterating properly. An advantage over older code using 999999 is that we don't have to manually clamp the value to a reasonable range; FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE, etc. don't care. An advantage of this over using -1 as a sentinel is that we don't have to carefully check and fill in the value in every function using it.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
int GetNumTapNotesWithScore( const NoteData &in, TapNoteScore tns, int iStartIndex = 0, int iEndIndex = 999999 )
|
||||
int GetNumTapNotesWithScore( const NoteData &in, TapNoteScore tns, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
|
||||
{
|
||||
int iNumSuccessfulTapNotes = 0;
|
||||
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||
@@ -22,7 +22,7 @@ int GetNumTapNotesWithScore( const NoteData &in, TapNoteScore tns, int iStartInd
|
||||
return iNumSuccessfulTapNotes;
|
||||
}
|
||||
|
||||
int GetNumNWithScore( const NoteData &in, TapNoteScore tns, int MinTaps, int iStartIndex = 0, int iEndIndex = 999999 )
|
||||
int GetNumNWithScore( const NoteData &in, TapNoteScore tns, int MinTaps, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
|
||||
{
|
||||
int iNumSuccessfulDoubles = 0;
|
||||
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, i, iStartIndex, iEndIndex )
|
||||
@@ -47,7 +47,7 @@ int GetNumNWithScore( const NoteData &in, TapNoteScore tns, int MinTaps, int iSt
|
||||
return iNumSuccessfulDoubles;
|
||||
}
|
||||
|
||||
int GetNumHoldNotesWithScore( const NoteData &in, HoldNoteScore hns, int iStartIndex = 0, int iEndIndex = 999999 )
|
||||
int GetNumHoldNotesWithScore( const NoteData &in, HoldNoteScore hns, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
|
||||
{
|
||||
int iNumSuccessfulHolds = 0;
|
||||
for( int i=0; i<in.GetNumHoldNotes(); i++ )
|
||||
@@ -61,7 +61,7 @@ int GetNumHoldNotesWithScore( const NoteData &in, HoldNoteScore hns, int iStartI
|
||||
return iNumSuccessfulHolds;
|
||||
}
|
||||
|
||||
int GetSuccessfulMines( const NoteData &in, int iStartIndex = 0, int iEndIndex = 999999 )
|
||||
int GetSuccessfulMines( const NoteData &in, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
|
||||
{
|
||||
int iNumSuccessfulMinesNotes = 0;
|
||||
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, i, iStartIndex, iEndIndex )
|
||||
@@ -78,7 +78,7 @@ int GetSuccessfulMines( const NoteData &in, int iStartIndex = 0, int iEndIndex =
|
||||
}
|
||||
|
||||
/* See NoteData::GetNumHands(). */
|
||||
int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex = 999999 )
|
||||
int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
|
||||
{
|
||||
int iNum = 0;
|
||||
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, i, iStartIndex, iEndIndex )
|
||||
|
||||
Reference in New Issue
Block a user