Restore the const nature of this variable.

Lambdas can be taken advantage of.
This commit is contained in:
Jason Felds
2013-04-27 16:06:17 -04:00
parent 2a5227afbb
commit 9ec7272416
+10 -10
View File
@@ -3004,20 +3004,20 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
* TODO: Move this to a separate function. */ * TODO: Move this to a separate function. */
if( HOLD_CHECKPOINTS && m_pPlayerState->m_PlayerController != PC_AUTOPLAY ) if( HOLD_CHECKPOINTS && m_pPlayerState->m_PlayerController != PC_AUTOPLAY )
{ {
int iCheckpointFrequencyRows = ROWS_PER_BEAT/2; int const iCheckpointFrequencyRows = [&]() {
if( CHECKPOINTS_USE_TICKCOUNTS ) if (CHECKPOINTS_USE_TICKCOUNTS)
{ {
int tickCurrent = m_Timing->GetTickcountAtRow( iLastRowCrossed ); int currentTick = m_Timing->GetTickcountAtRow(iLastRowCrossed);
// There are some charts that don't want tickcounts involved at all. // some charts don't want tickcounts involved.
iCheckpointFrequencyRows = (tickCurrent > 0 ? ROWS_PER_BEAT / tickCurrent : 0); return (currentTick > 0 ? ROWS_PER_BEAT / currentTick : 0);
} }
else if( CHECKPOINTS_USE_TIME_SIGNATURES ) if (CHECKPOINTS_USE_TIME_SIGNATURES)
{ {
TimeSignatureSegment * tSignature = m_Timing->GetTimeSignatureSegmentAtRow( iLastRowCrossed ); TimeSignatureSegment const *seg = m_Timing->GetTimeSignatureSegmentAtRow(iLastRowCrossed);
return ROWS_PER_BEAT * seg->GetDen() / (seg->GetNum() * 4);
// Most songs are in 4/4 time. The frequency for checking tick counts should reflect that.
iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature->GetDen() / (tSignature->GetNum() * 4);
} }
return ROWS_PER_BEAT / 2;
}();
if( iCheckpointFrequencyRows > 0 ) if( iCheckpointFrequencyRows > 0 )
{ {