Fix #DISPLAYBPM in DWIs for real.

This commit is contained in:
Glenn Maynard
2003-06-13 23:15:09 +00:00
parent 9d3db00a96
commit a41998c22c
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -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
{