diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 27238dd30d..d0bb4eab8a 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -155,7 +155,7 @@ bool IniFile::GetValue(const CString &keyname, const CString &valuename, float& CString sValue; if( !GetValue(keyname,valuename,sValue) ) return false; - sscanf( sValue.c_str(), "%f", &value ); + value = strtof( sValue, NULL ); return true; } diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 3ad03876f2..e828044bc3 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -216,16 +216,17 @@ void Model::LoadMaterialsFromMilkshapeAscii( CString sPath ) // shininess if( f.GetLine( sLine ) <= 0 ) THROW - float fShininess; - if (sscanf (sLine, "%f", &fShininess) != 1) + char *p; + float fShininess = strtof( sLine, &p ); + if ( p == sLine ) THROW Material.fShininess = fShininess; // transparency if( f.GetLine( sLine ) <= 0 ) THROW - float fTransparency; - if (sscanf (sLine, "%f", &fTransparency) != 1) + float fTransparency = strtof( sLine, &p ); + if ( p == sLine ) THROW Material.fTransparency = fTransparency; diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index 070fad2cac..1a6327fe03 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -198,8 +198,9 @@ void PlayerOptions::FromString( CString sOptions ) if( mult.Compare(sBit, matches) ) { m_fTimeSpacing = 0.0f; - int ret = sscanf( matches[0], "%f", &m_fScrollSpeed ); - ASSERT( ret == 1 ); + char *p = NULL; + m_fScrollSpeed = strtof( matches[0], &p ); + ASSERT( p != matches[0] ); continue; } @@ -231,8 +232,7 @@ void PlayerOptions::FromString( CString sOptions ) if( asParts[j].Right(1) == "*" ) RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?", atoi(asParts[j]), atoi(asParts[j]) ); - sscanf( asParts[j], "%f", &level ); - level /= 100.0f; + level = strtof( asParts[j], NULL ) / 100.0f; } else if( asParts[j][0]=='*' ) sscanf( asParts[j], "*%f", &speed ); diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp index 87c25add44..267f8e4df6 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -78,8 +78,9 @@ void SongOptions::FromString( CString sOptions ) vector matches; if( mult.Compare(sBit, matches) ) { - int ret = sscanf( matches[0], "%f", &m_fMusicRate ); - ASSERT( ret == 1 ); + char *p = NULL; + m_fMusicRate = strtof( matches[0], &p ); + ASSERT( p != matches[0] ); } matches.clear();