2 * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
8 #include "vg/vg_store.h"
9 #include "vg/vg_stdint.h"
10 #include "world_info.h"
13 * Designed to be used across client and server,
14 * for the client its only storing the local users records, for server its
18 typedef struct highscore highscore
;
19 typedef struct highscore_record highscore_record
;
20 typedef struct highscore_track_table highscore_track_table
;
21 typedef struct highscore_database highscore_database
;
22 typedef struct highscore_playerinfo highscore_playerinfo
;
26 struct highscore_playerinfo
33 aatree_pool_node aapn
;
34 aatree_node aa_playerid
;
38 struct highscore_record
40 u16 trackid
, points
, time
, reserved0
;
56 aatree_pool_node pool
;
60 struct highscore_track_table
62 aatree_ptr root_points
,
70 struct highscore_database
72 highscore_track_table tracks
[ 128 ];
74 aatree_ptr pool_head
, playerinfo_head
;
76 playerinfo_capacity
, playerinfo_root
;
83 static struct highscore_system
85 highscore_database dbheader
;
91 aainfo_playerinfo_playerid
,
97 u32 pool_size
, playerinfo_pool_size
;
101 static int highscore_intr( char *buf
, int value
, int len
, char alt
);
102 static int highscore_intl( char *buf
, int value
, int len
);
103 static void highscores_board_printf( FILE *fp
, const char *buf
, u32 count
);
104 static aatree_ptr
highscore_set_user_nickname( u64 steamid
, char nick
[16] );
105 static aatree_ptr
highscores_push_record( highscore_record
*record
);
106 static void highscores_board_generate( char *buf
, u32 id
, u32 count
);
107 static void highscores_init( u32 pool_size
, u32 playerinfo_pool_size
);
108 static int highscores_read( const char *path
);
109 static void highscores_create_db(void);
110 static int highscores_serialize_all(void);
112 #endif /* HIGHSCORES_H */