sscanf("%f") -> strtof()

This commit is contained in:
Glenn Maynard
2004-08-10 22:19:06 +00:00
parent aad73b53e9
commit f0c0a532f9
4 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -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;
}
+5 -4
View File
@@ -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;
+4 -4
View File
@@ -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 );
+3 -2
View File
@@ -78,8 +78,9 @@ void SongOptions::FromString( CString sOptions )
vector<CString> 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();