X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=highscores.h;h=28662bfa0a403c2b15f9fa1f56525ab828a71881;hb=5e22cdfe9f6f83e807ce6456ab538d02104cd01d;hp=78db2ad3105961b74a2f6115ba15c8d7e1e0858c;hpb=c2d67378dd5c82de50b8fbbbe222ec6be2da4eee;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/highscores.h b/highscores.h index 78db2ad..28662bf 100644 --- a/highscores.h +++ b/highscores.h @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ + #ifndef HIGHSCORES_H #define HIGHSCORES_H @@ -128,7 +132,7 @@ static int highscore_cmp_playerinfo_playerid( void *a, void *b ) static void *highscore_malloc( u32 count, u32 size ) { size_t requested_mem = size * count; - void *data = malloc( requested_mem ); + void *data = vg_alloc( requested_mem ); requested_mem /= 1024; requested_mem /= 1024; @@ -146,8 +150,8 @@ static void *highscore_malloc( u32 count, u32 size ) static void highscores_free(void) { - free( highscore_system.data ); - free( highscore_system.playerinfo_data ); + vg_free( highscore_system.data ); + vg_free( highscore_system.playerinfo_data ); } static int highscores_init( u32 pool_size, u32 playerinfo_pool_size ) @@ -161,7 +165,7 @@ static int highscores_init( u32 pool_size, u32 playerinfo_pool_size ) highscore_malloc( playerinfo_pool_size, sizeof(highscore_playerinfo)); if( !sys->playerinfo_data ) { - free( sys->data ); + vg_free( sys->data ); return 0; } @@ -314,7 +318,6 @@ static aatree_ptr highscores_push_record( highscore_record *record ) { struct highscore_system *sys = &highscore_system; - /* TODO: Verify steam ID */ vg_low( "Inserting record into database for track %hu\n",record->trackid ); if( record->trackid >= vg_list_size(sys->dbheader.tracks) ) @@ -565,7 +568,7 @@ static void highscores_board_generate( char *buf, u32 id, u32 count ) highscore_strc ( buf+w*0, inf->name, w,w ); highscore_clear( buf+w*1, '-', w ); - highscore_strl ( buf+w*2, " #| Player | Time | Pts", 27 ); + highscore_strl ( buf+w*2, " #| Player | Time ", 27 ); for( int i=0; iaainfo_playerinfo_playerid, info_ptr ); - highscore_strl( line+3, inf->nickname, 10 ); + highscore_strl( line+3, inf->nickname, 16 ); } u16 centiseconds = record->time, @@ -606,14 +609,16 @@ static void highscores_board_generate( char *buf, u32 id, u32 count ) if( minutes > 9 ) minutes = 9; /* Timer */ - highscore_intr( line+14, minutes, 1, '0' ); - line[15] = ':'; - highscore_intr( line+16, seconds, 2, '0' ); - line[18] = '.'; - highscore_intr( line+19, centiseconds, 2, '0' ); + highscore_intr( line+20, minutes, 1, '0' ); + line[21] = ':'; + highscore_intr( line+22, seconds, 2, '0' ); + line[24] = '.'; + highscore_intr( line+25, centiseconds, 2, '0' ); +#if 0 /* Score */ highscore_intl( line+22, record->points, 5 ); +#endif it = aatree_next( &sys->aainfo_time, it ); } }