fix "100%" not stripped if there's a leading speed

This commit is contained in:
Chris Danford
2005-03-14 20:16:39 +00:00
parent b0822896b9
commit 81290aa995
+8 -15
View File
@@ -571,21 +571,6 @@ bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail )
CString PlayerOptions::ThemeMod( CString sOneMod )
{
// Strip out the approach speed token
if( !sOneMod.empty() && sOneMod[0]=='*' )
{
int iPos = sOneMod.Find(' ');
if( iPos != -1 )
sOneMod.erase( sOneMod.begin(), sOneMod.begin()+iPos+1 );
}
// Strip out "100% "
#define PERCENT_100 "100% "
if( !strncmp( sOneMod, PERCENT_100, sizeof(PERCENT_100)) )
{
sOneMod.erase( sOneMod.begin(), sOneMod.begin()+sizeof(PERCENT_100) );
}
// Change all token to first letter capitalized, rest lowercase
CStringArray asTokens;
split( sOneMod, " ", asTokens );
@@ -595,6 +580,14 @@ CString PlayerOptions::ThemeMod( CString sOneMod )
*s = Capitalize( *s );
}
// Strip the approach speed token, if any
if( asTokens[0][0] == '*' )
asTokens.erase( asTokens.begin() );
// Strip "100%", if any
if( asTokens[0] == "100%" )
asTokens.erase( asTokens.begin() );
/* Theme the mod name (the last string). Allow this to not exist, since
* characters might use modifiers that don't exist in the theme. */
if( THEME->HasMetric( "OptionNames", asTokens.back() ) )