diff --git a/stepmania/src/AdjustSync.cpp b/stepmania/src/AdjustSync.cpp index 21cea42a8b..ca26671bee 100644 --- a/stepmania/src/AdjustSync.cpp +++ b/stepmania/src/AdjustSync.cpp @@ -225,8 +225,7 @@ void AdjustSync::AutosyncTempo() // be enough in most cases. float fFilteredError = 0.0; s_iStepsFiltered = s_vAutosyncTempoData.size(); - FilterHighErrorPoints( &s_vAutosyncTempoData, - fSlope, fIntercept, ERROR_TOO_HIGH ); + FilterHighErrorPoints( s_vAutosyncTempoData, fSlope, fIntercept, ERROR_TOO_HIGH ); s_iStepsFiltered -= s_vAutosyncTempoData.size(); if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, fFilteredError ) ) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index b504f5caa8..38b5f60ceb 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -1027,21 +1027,20 @@ bool CalcLeastSquares( const vector< pair > &vCoordinates, return true; } -void FilterHighErrorPoints( vector< pair > *vCoordinates, +void FilterHighErrorPoints( vector< pair > &vCoordinates, float fSlope, float fIntercept, float fCutoff ) { unsigned int iOut = 0; - for( unsigned int iIn = 0; iIn < vCoordinates->size(); ++iIn ) + for( unsigned int iIn = 0; iIn < vCoordinates.size(); ++iIn ) { - float fError = ((*vCoordinates)[iIn].second - - (fIntercept + fSlope * (*vCoordinates)[iIn].first)); + const float fError = fIntercept + fSlope * vCoordinates[iIn].first - vCoordinates[iIn].second; if( fabsf(fError) < fCutoff ) { - (*vCoordinates)[iOut] = (*vCoordinates)[iIn]; + vCoordinates[iOut] = vCoordinates[iIn]; ++iOut; } } - vCoordinates->resize(iOut); + vCoordinates.resize( iOut ); } void TrimLeft( RString &sStr, const char *s ) diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 8892cef5d6..1c31c811aa 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -456,7 +456,7 @@ bool CalcLeastSquares( const vector< pair > &vCoordinates, * This method throws away any points that are more than fCutoff away from * the line defined by fSlope and fIntercept. */ -void FilterHighErrorPoints( vector< pair > *vCoordinates, +void FilterHighErrorPoints( vector< pair > &vCoordinates, float fSlope, float fIntercept, float fCutoff ); template