boards now pickable
[carveJwlIkooP6JGAAIwe30JlM.git] / highscores.h
index 079e4d8d69af2befbed093ddbb2a5b4ddb20f6d0..3a2071758a8c04f76c6ddd8d5a2a1ead67d1c62d 100644 (file)
@@ -478,13 +478,14 @@ VG_STATIC void highscore_strr( char *buf, const char *str, int len, int width )
    }
 }
 
-/* Print integer (padded with: alt), right aligned into buf(width: len) */
-VG_STATIC void highscore_intr( char *buf, int value, int len, char alt )
+/* Print integer (padded with: alt), right aligned into buf(width: len)
+ * returns number of digits (not including alt), that were written to buf */
+VG_STATIC int highscore_intr( char *buf, int value, int len, char alt )
 {
    int i=0;
    while(value){
       if( i>=len ) 
-         return;
+         return i;
 
       buf[ len-1 - (i ++) ] = '0' + (value % 10);
       value /= 10;
@@ -492,16 +493,18 @@ VG_STATIC void highscore_intr( char *buf, int value, int len, char alt )
 
    for( ;i<len; i ++ )
       buf[ len-1 - i ] = alt;
+
+   return i;
 }
 
-/* Print integer into buffer with max length len */
-VG_STATIC void highscore_intl( char *buf, int value, int len )
+/* 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];
 
    int i=0;
-   while(value)
-   {
+   while(value){
       if( i>=len ) 
          break;
 
@@ -513,9 +516,9 @@ VG_STATIC void highscore_intl( char *buf, int value, int len )
       i = len;
 
    for( int j=0; j<i; j ++ )
-   {
       buf[j] = temp[ i-1-j ];
-   }
+
+   return i;
 }
 
 /* Clear buffer with length using clr character */