diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 2aa565f3ad..b16db6ba0a 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -337,7 +337,25 @@ void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn ) SetTapNote( iTrack, iStartRow, tn ); } -/* Return true if a hold note lies on or adjacent to the given spot. */ +/* Determine if a hold note lies on the given spot. Return true if so. If + * pHeadRow is non-NULL, return the row of the head. */ +bool NoteData::IsHoldHeadOrBodyAtRow( int iTrack, int iRow, int *pHeadRow ) const +{ + const TapNote &tn = GetTapNote( iTrack, iRow ); + if( tn.type == TapNote::hold_head ) + { + if( pHeadRow != NULL ) + *pHeadRow = iRow; + return true; + } + + return IsHoldNoteAtRow( iTrack, iRow, pHeadRow ); +} + +/* Determine if a hold note lies on the given spot. Return true if so. If + * pHeadRow is non-NULL, return the row of the head. (Note that this returns + * false if a hold head lies on iRow itself.) */ +/* XXX: rename this to IsHoldBodyAtRow */ bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const { int iDummy; @@ -354,7 +372,6 @@ bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const switch( tn.type ) { case TapNote::hold_head: -// if( tn.iDuration + r <= iRow ) if( tn.iDuration + r < iRow ) return false; *pHeadRow = r; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index e7ae857b3e..49649e9912 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -116,11 +116,9 @@ public: void GetTracksHeldAtRow( int row, set& addTo ); int GetNumTracksHeldAtRow( int row ); - /* Determine if a given spot is within a hold note (being on the tail doesn't count). - * Return true if so. If pHeadRow is non-NULL, return the row of the head. If pTailRow is - * non-NULL, return the row of the tail. This function is faster if pTailRow is NULL. */ bool IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow = NULL ) const; - + bool IsHoldHeadOrBodyAtRow( int iTrack, int iRow, int *pHeadRow ) const; + // // statistics //