clean up mod strings before displaying
This commit is contained in:
@@ -49,27 +49,40 @@ void ActiveAttackList::Update( float fDelta )
|
|||||||
if( !attack.bOn )
|
if( !attack.bOn )
|
||||||
continue; /* hasn't started yet */
|
continue; /* hasn't started yet */
|
||||||
|
|
||||||
CString sDisplayText = attack.sModifier;
|
CString sMods = attack.sModifier;
|
||||||
|
CStringArray asMods;
|
||||||
// Strip out the approach speed token
|
split( sMods, ", ", asMods );
|
||||||
if( !sDisplayText.empty() && sDisplayText[0]=='*' )
|
for( int j=0; j<asMods.size(); j++ )
|
||||||
{
|
{
|
||||||
int iPos = sDisplayText.Find(' ');
|
CString& sMod = asMods[j];
|
||||||
if( iPos != -1 )
|
|
||||||
sDisplayText.erase( sDisplayText.begin(), sDisplayText.begin()+iPos+1 );
|
// Strip out the approach speed token
|
||||||
|
if( !sMod.empty() && sMod[0]=='*' )
|
||||||
|
{
|
||||||
|
int iPos = sMod.Find(' ');
|
||||||
|
if( iPos != -1 )
|
||||||
|
sMod.erase( sMod.begin(), sMod.begin()+iPos+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strip out "100% "
|
||||||
|
#define PERCENT_100 "100% "
|
||||||
|
if( !strncmp( sMod, PERCENT_100, sizeof(PERCENT_100)) )
|
||||||
|
{
|
||||||
|
sMod.erase( sMod.begin(), sMod.begin()+sizeof(PERCENT_100) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Capitalize all tokens
|
||||||
|
CStringArray asTokens;
|
||||||
|
split( sMod, " ", asTokens );
|
||||||
|
sMod.erase( sMod.begin(), sMod.end() );
|
||||||
|
for( int i=0; i<asTokens.size(); i++ )
|
||||||
|
sMod += Capitalize( asTokens[i] ) + " ";
|
||||||
|
|
||||||
|
if( s.empty() )
|
||||||
|
s = sMod;
|
||||||
|
else
|
||||||
|
s = sMod + "\n" + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capitalize all tokens
|
|
||||||
CStringArray asTokens;
|
|
||||||
split( sDisplayText, " ", asTokens );
|
|
||||||
sDisplayText.erase( sDisplayText.begin(), sDisplayText.end() );
|
|
||||||
for( int i=0; i<asTokens.size(); i++ )
|
|
||||||
sDisplayText += Capitalize( asTokens[i] );
|
|
||||||
|
|
||||||
if( s.empty() )
|
|
||||||
s = sDisplayText;
|
|
||||||
else
|
|
||||||
s = sDisplayText + "\n" + s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same.
|
this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same.
|
||||||
|
|||||||
Reference in New Issue
Block a user