diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index 604184988f..27da8723ff 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -316,14 +316,20 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out ) else if( 0==stricmp(sValueName,"DISPLAYBPM") ) { // #DISPLAYBPM:[xxx..xxx]|[xxx]|[*]; - if( sscanf( sParams[1], "%f..%f", &out.m_fDisplayBPMMin, &out.m_fDisplayBPMMax ) == 2 ) + int iMin, iMax; + /* We can't parse this as a float with sscanf, since '.' is a valid + * character in a float. (We could do it with a regex, but it's not + * worth bothering with since we don't display fractional BPM anyway.) */ + if( sscanf( sParams[1], "%i..%i", &iMin, &iMax ) == 2 ) { out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_fDisplayBPMMin = (float) iMin; + out.m_fDisplayBPMMax = (float) iMax; } - else if( sscanf( sParams[1], "%f", &out.m_fDisplayBPMMin ) == 1 ) + else if( sscanf( sParams[1], "%i", &iMin ) == 1 ) { out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; - out.m_fDisplayBPMMax = out.m_fDisplayBPMMin; + out.m_fDisplayBPMMin = out.m_fDisplayBPMMax = (float) iMin; } else { diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 78bfbcddd0..6cf18b7521 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -236,9 +236,9 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out ) break; case Song::DISPLAY_SPECIFIED: if( out.m_fDisplayBPMMin == out.m_fDisplayBPMMax ) - fprintf( fp, "#DISPLAYBPM:%.3f;\n", out.m_fDisplayBPMMin ); + fprintf( fp, "#DISPLAYBPM:%i;\n", (int) out.m_fDisplayBPMMin ); else - fprintf( fp, "#DISPLAYBPM:%.3f..%.3f;\n", out.m_fDisplayBPMMin, out.m_fDisplayBPMMax ); + fprintf( fp, "#DISPLAYBPM:%i..%i;\n", (int) out.m_fDisplayBPMMin, (int) out.m_fDisplayBPMMax ); break; case Song::DISPLAY_RANDOM: fprintf( fp, "#DISPLAYBPM:*" );