X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=highscores.c;h=6593b9a47696c20382aac41b192fd424d03dffbb;hb=dbbdf411d1aaf70cb995c3371cfae37fd0b7dbcc;hp=77ffc412de82d4a32c9246d304a89cf692b02ad5;hpb=d07048b61445be11605adba43667e19214358a24;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/highscores.c b/highscores.c index 77ffc41..6593b9a 100644 --- a/highscores.c +++ b/highscores.c @@ -402,26 +402,30 @@ VG_STATIC int highscore_intr( char *buf, int value, int len, char alt ) /* Print integer into buffer with max length len * retuns the number of digits written to buf */ -VG_STATIC int highscore_intl( char *buf, int value, int len ) -{ - char temp[32]; +VG_STATIC int highscore_intl( char *buf, int value, int len ){ + if( value ){ + char temp[32]; + int i=0; + while(value){ + if( i>=len ) + break; + + temp[ i ++ ] = '0' + (value % 10); + value /= 10; + } - int i=0; - while(value){ - if( i>=len ) - break; + if( i>len ) + i = len; - temp[ i ++ ] = '0' + (value % 10); - value /= 10; - } - - if( i>len ) - i = len; - - for( int j=0; j