Simplify.
This commit is contained in:
@@ -222,17 +222,16 @@ void Model::LoadMaterialsFromMilkshapeAscii( RString sPath )
|
|||||||
// shininess
|
// shininess
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW;
|
THROW;
|
||||||
char *p;
|
float fShininess;
|
||||||
float fShininess = strtof( sLine, &p );
|
if( !FromString(sLine, fShininess) )
|
||||||
if( p == sLine )
|
|
||||||
THROW;
|
THROW;
|
||||||
Material.fShininess = fShininess;
|
Material.fShininess = fShininess;
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW;
|
THROW;
|
||||||
float fTransparency = strtof( sLine, &p );
|
float fTransparency;
|
||||||
if( p == sLine )
|
if( !FromString(sLine, fTransparency) )
|
||||||
THROW;
|
THROW;
|
||||||
Material.fTransparency = fTransparency;
|
Material.fTransparency = fTransparency;
|
||||||
|
|
||||||
|
|||||||
@@ -107,19 +107,12 @@ void SongOptions::FromString( const RString &sOptions )
|
|||||||
Regex mult("^([0-9]+(\\.[0-9]+)?)xmusic$");
|
Regex mult("^([0-9]+(\\.[0-9]+)?)xmusic$");
|
||||||
vector<RString> matches;
|
vector<RString> matches;
|
||||||
if( mult.Compare(sBit, matches) )
|
if( mult.Compare(sBit, matches) )
|
||||||
{
|
::FromString( matches[0], m_fMusicRate );
|
||||||
char *p = NULL;
|
|
||||||
m_fMusicRate = strtof( matches[0], &p );
|
|
||||||
ASSERT( p != matches[0] );
|
|
||||||
}
|
|
||||||
|
|
||||||
matches.clear();
|
matches.clear();
|
||||||
Regex lives("^([0-9]+) ?(lives|life)$");
|
Regex lives("^([0-9]+) ?(lives|life)$");
|
||||||
if( lives.Compare(sBit, matches) )
|
if( lives.Compare(sBit, matches) )
|
||||||
{
|
::FromString( matches[0], m_iBatteryLives );
|
||||||
int ret = sscanf( matches[0], "%i", &m_iBatteryLives );
|
|
||||||
ASSERT( ret == 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<RString> asParts;
|
vector<RString> asParts;
|
||||||
split( sBit, " ", asParts, true );
|
split( sBit, " ", asParts, true );
|
||||||
@@ -132,7 +125,7 @@ void SongOptions::FromString( const RString &sOptions )
|
|||||||
on = false;
|
on = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER;
|
if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER;
|
||||||
else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
||||||
else if( sBit == "power-drop" ) m_DrainType = DRAIN_NO_RECOVER;
|
else if( sBit == "power-drop" ) m_DrainType = DRAIN_NO_RECOVER;
|
||||||
else if( sBit == "death" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
else if( sBit == "death" ) m_DrainType = DRAIN_SUDDEN_DEATH;
|
||||||
|
|||||||
Reference in New Issue
Block a user