From 7dc7d2a91727b729d54236e9c27178286fbaf336 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 8 Jan 2005 14:00:15 +0000 Subject: [PATCH] cleanup: use TimingData::SetStopAtBeat use strtod(), not atof() (to avoid double to float warnings) --- stepmania/src/ScreenEdit.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index c8fe1284d1..89f4ad1462 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -1532,40 +1532,16 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) break; case SM_BackFromBPMChange: { - float fBPM = atof( ScreenTextEntry::s_sLastAnswer.c_str() ); - if ( fBPM <= 0 ) - break; - m_pSong->SetBPMAtBeat( GAMESTATE->m_fSongBeat, fBPM ); + float fBPM = strtof( ScreenTextEntry::s_sLastAnswer, NULL ); + if( fBPM > 0 ) + m_pSong->SetBPMAtBeat( GAMESTATE->m_fSongBeat, fBPM ); } break; case SM_BackFromStopChange: { - unsigned i; - bool sentinel = false; //Tricky, we can't break out of this loop safely - for( i=0; (im_Timing.m_StopSegments.size()) && (!sentinel); i++ ) - { - if( m_pSong->m_Timing.m_StopSegments[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) - sentinel = true; - } - - if ( sentinel ) - i--; - - float fStop = atof( ScreenTextEntry::s_sLastAnswer.c_str() ); - - if( i == m_pSong->m_Timing.m_StopSegments.size() ) // there is no BPMSegment at the current beat - { - if ( fStop > 0 ) - m_pSong->AddStopSegment( StopSegment(GAMESTATE->m_fSongBeat, fStop ) ); - } - else // StopSegment being modified is m_Timing.m_StopSegments[i] - { - m_pSong->m_Timing.m_StopSegments[i].m_fStopSeconds = fStop; - if( m_pSong->m_Timing.m_StopSegments[i].m_fStopSeconds <= 0 ) - m_pSong->m_Timing.m_StopSegments.erase( m_pSong->m_Timing.m_StopSegments.begin()+i, - m_pSong->m_Timing.m_StopSegments.begin()+i+1); - } - + float fStop = strtof( ScreenTextEntry::s_sLastAnswer, NULL ); + if( fStop >= 0 ) + m_pSong->m_Timing.SetStopAtBeat( GAMESTATE->m_fSongBeat, fStop ); } break; case SM_BackFromBGChange: