X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=highscores.h;h=817a503870ef602ed543f81338873e2e5fc6238d;hb=7796f3f18ba78b42599f199523fdb0fdabc5efa1;hp=f49537fb7b0f428b0e204623236b1f8583e777c5;hpb=5430d708f058626a6c8fed7dd2aa8ba5f0a06c84;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/highscores.h b/highscores.h index f49537f..817a503 100644 --- a/highscores.h +++ b/highscores.h @@ -310,8 +310,7 @@ VG_STATIC aatree_ptr highscores_push_record( highscore_record *record ) vg_low( "Inserting record into database for track %hu\n",record->trackid ); - if( record->trackid >= vg_list_size(sys->dbheader.tracks) ) - { + if( record->trackid >= vg_list_size(sys->dbheader.tracks) ){ vg_error( "TrackID out of range (%hu>=%d)\n", record->trackid, vg_list_size(sys->dbheader.tracks) ); @@ -324,8 +323,7 @@ VG_STATIC aatree_ptr highscores_push_record( highscore_record *record ) table->root_playerid, record ); - if( existing != AATREE_PTR_NIL ) - { + if( existing != AATREE_PTR_NIL ){ highscore_record *crecord = aatree_get_data( &sys->aainfo_playerid, existing ); @@ -478,14 +476,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) - { + while(value){ if( i>=len ) - return; + return i; buf[ len-1 - (i ++) ] = '0' + (value % 10); value /= 10; @@ -493,16 +491,18 @@ VG_STATIC void highscore_intr( char *buf, int value, int len, char alt ) for( ;i=len ) break; @@ -514,9 +514,9 @@ VG_STATIC void highscore_intl( char *buf, int value, int len ) i = len; for( int j=0; j