From c6732a87a681b5ccd10f2f180e7c55bf01874397 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 16 Oct 2002 19:01:11 +0000 Subject: [PATCH] Fix wrapping of m_fItemAtTopOfList causing crash if we delay long enough to need to wrap twice. (Only happened while debugging, but.) --- stepmania/src/CourseContentsFrame.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/stepmania/src/CourseContentsFrame.cpp b/stepmania/src/CourseContentsFrame.cpp index 5fa6d4e161..b7bd715586 100644 --- a/stepmania/src/CourseContentsFrame.cpp +++ b/stepmania/src/CourseContentsFrame.cpp @@ -93,7 +93,7 @@ void CourseContentsFrame::SetFromCourse( Course* pCourse ) { ASSERT( pCourse != NULL ); - m_fTimeUntilScroll = 3; + m_fTimeUntilScroll = 0; m_fItemAtTopOfList = 0; m_iNumContents = 0; @@ -124,10 +124,10 @@ void CourseContentsFrame::Update( float fDeltaTime ) if( m_fTimeUntilScroll > 0 && m_iNumContents > MAX_VISIBLE_CONTENTS) m_fTimeUntilScroll -= fDeltaTime; - if( m_fTimeUntilScroll <= 0 ) + if( m_fTimeUntilScroll <= 0 ) { m_fItemAtTopOfList += fDeltaTime; - if( m_fItemAtTopOfList > m_iNumContents ) - m_fItemAtTopOfList -= m_iNumContents; + m_fItemAtTopOfList = fmodf(m_fItemAtTopOfList, float(m_iNumContents)); + } for( int i=0; i