Merge branch 'master' of harrygodden.com:/home/carveJwlIkooP6JGAAIwe30JlM
[carveJwlIkooP6JGAAIwe30JlM.git] / highscores.c
index d1866ae58d5a86a1cba27503e508ae3003fb9a78..c72b9876d7f13bbd13259bf692ade95cbb282c10 100644 (file)
@@ -64,11 +64,13 @@ static void highscores_create_db(void)
    sys->dbheader.playerinfo_root = AATREE_PTR_NIL;
 }
 
-static int highscores_read(void)
-{
+static int highscores_read( const char *path ){
    struct highscore_system *sys = &highscore_system;
 
-   FILE *fp = fopen( ".aadb", "rb" );
+   if( path == NULL )
+      path = ".aadb";
+
+   FILE *fp = fopen( path, "rb" );
    if( fp ){
       vg_info( "Loading existing database\n" );
       
@@ -106,7 +108,7 @@ static int highscores_read(void)
    }
    else
    {
-      vg_low( "No existing database found (.aadb)\n" );
+      vg_low( "No existing database found (%s)\n", path );
       return 0;
    }
 }
@@ -159,6 +161,7 @@ static void highscores_init( u32 pool_size, u32 playerinfo_pool_size )
       offsetof(highscore_playerinfo,aa_playerid);
    sys->aainfo_playerinfo_playerid.p_cmp = highscore_cmp_playerinfo_playerid;
 
+   /* TODO: Is this even useable? */
    sys->aainfo_playerinfo.base = highscore_system.playerinfo_data;
    sys->aainfo_playerinfo.stride = sizeof(highscore_playerinfo);
    sys->aainfo_playerinfo.offset = offsetof(highscore_playerinfo,aapn);