X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=gameserver.c;fp=gameserver.c;h=3b58b2360fda202c502d40a4c142849d200fdd8a;hb=524c05104673b95ef0841d6ee90bcd24f9b829dc;hp=efc0bbfa72fde60adf25d95e93e5eb7ebf061279;hpb=603805f69c5484316a52ee099d03254c5a1096f3;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gameserver.c b/gameserver.c index efc0bbf..3b58b23 100644 --- a/gameserver.c +++ b/gameserver.c @@ -9,15 +9,16 @@ volatile sig_atomic_t sig_stop; -static void inthandler( int signum ) { - sig_stop = 1; -} - #include "gameserver.h" #include "highscores.c" #include "servermonitor_server.c" #include "vg/vg_opt.h" #include "network_common.h" +#include "gameserver_db.h" + +static void inthandler( int signum ) { + sig_stop = 1; +} static const u64 k_connection_unauthorized = 0xffffffffffffffff; @@ -524,6 +525,19 @@ static void generate_boards(void){ } int main( int argc, char *argv[] ){ + db_init(); + char table[DB_TABLE_UID_MAX]; + if( db_get_highscore_table_name( "sr003-local-mp_mtzero", + "megapark-yellow", 302, table ) ){ + if( db_writeusertime( table, 76561198072130043, 232, 1 ) ){ + vg_success( "Written time\n" ); + i32 v = db_readusertime( table, 76561198072130043 ); + vg_success( "Returned time: %u\n", v ); + } + } + db_free(); + return 0; + signal( SIGINT, inthandler ); signal( SIGQUIT, inthandler ); signal( SIGPIPE, SIG_IGN ); @@ -541,7 +555,7 @@ int main( int argc, char *argv[] ){ highscores_init( 250000, 10000 ); - if( !highscores_read() ) + if( !highscores_read(NULL) ) highscores_create_db(); steamworks_ensure_txt( "2103940" ); @@ -639,6 +653,7 @@ int main( int argc, char *argv[] ){ vg_info( "Shutting down\n..." ); SteamGameServer_Shutdown(); + db_free(); return 0; }