don't draw the last 0 in '0000' as a leading zero

This commit is contained in:
Chris Danford
2008-08-18 02:07:08 +00:00
parent 04114173b0
commit ca2ba49384
+7
View File
@@ -36,11 +36,18 @@ void RollingNumbers::DrawPrimitives()
RString s = this->GetText();
int i;
// find the first non-zero, non-comma character
for( i=0; i<(int)s.length(); i++ )
{
if( s[i] != '0' && s[i] != ',' )
break;
}
// Rewind to the first number, even if it's a zero. If the string is "0000", we want the last zero to show in the regular color.
for( ; i>=0; i-- )
{
if( s[i] >= '0' && s[i] <= '9' )
break;
}
float f = i / (float)s.length();
// draw leading part