allow negative mod percentages
This commit is contained in:
@@ -230,23 +230,27 @@ void PlayerOptions::FromString( CString sOptions, bool bWarnOnInvalid )
|
|||||||
CStringArray asParts;
|
CStringArray asParts;
|
||||||
split( sBit, " ", asParts, true );
|
split( sBit, " ", asParts, true );
|
||||||
|
|
||||||
for( unsigned j = 0; j < asParts.size()-1; ++j )
|
FOREACH_CONST( CString, asParts, s )
|
||||||
|
{
|
||||||
|
if( *s == "no" )
|
||||||
{
|
{
|
||||||
if( asParts[j] == "no" )
|
|
||||||
level = 0;
|
level = 0;
|
||||||
else if( isdigit(asParts[j][0]) )
|
}
|
||||||
|
else if( isdigit((*s)[0]) || (*s)[0] == '-' )
|
||||||
{
|
{
|
||||||
/* If the last character is a *, they probably said "123*" when
|
/* If the last character is a *, they probably said "123*" when
|
||||||
* they meant "*123". */
|
* they meant "*123". */
|
||||||
if( asParts[j].Right(1) == "*" )
|
if( s->Right(1) == "*" )
|
||||||
RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?",
|
RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?",
|
||||||
atoi(asParts[j]), atoi(asParts[j]) );
|
atoi(*s), atoi(*s) );
|
||||||
level = strtof( asParts[j], NULL ) / 100.0f;
|
level = strtof( *s, NULL ) / 100.0f;
|
||||||
}
|
}
|
||||||
else if( asParts[j][0]=='*' )
|
else if( *s[0]=='*' )
|
||||||
sscanf( asParts[j], "*%f", &speed );
|
{
|
||||||
|
sscanf( *s, "*%f", &speed );
|
||||||
}
|
}
|
||||||
sBit = asParts[asParts.size()-1];
|
}
|
||||||
|
sBit = asParts.back();
|
||||||
|
|
||||||
#define SET_FLOAT( opt ) { m_ ## opt = level; m_Speed ## opt = speed; }
|
#define SET_FLOAT( opt ) { m_ ## opt = level; m_Speed ## opt = speed; }
|
||||||
const bool on = (level > 0.5f);
|
const bool on = (level > 0.5f);
|
||||||
|
|||||||
Reference in New Issue
Block a user