X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=gameserver.c;h=1d513f47b7e416b7ffa5f9a309d27db785de86c7;hb=5fa590f62aa7e62a8b6b07e10556c2ecc54cdca6;hp=e36e60f704c345030c9189fab49d27ab42046353;hpb=3abfa7589349a860ecb5cc4f18f400c9963f4ab9;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gameserver.c b/gameserver.c index e36e60f..1d513f4 100644 --- a/gameserver.c +++ b/gameserver.c @@ -6,12 +6,11 @@ #include #include #include +#include volatile sig_atomic_t sig_stop; #include "gameserver.h" -#include "highscores.c" -#include "servermonitor_server.c" #include "vg/vg_opt.h" #include "network_common.h" #include "gameserver_db.h" @@ -517,7 +516,7 @@ static void gameserver_propogate_player_frame( int client_id, basic->sound_effects = 0; struct gameserver_client *c0 = &gameserver.clients[client_id]; - c0->instance = frame->instance_id; + c0->instance = frame->flags & NETMSG_PLAYERFRAME_INSTANCE_ID; for( int i=0; isteamid, centiseconds, 1 ); db_writeusertime( weekly_table, client->steamid, centiseconds, 1 ); - gameserver_request_respond( k_request_status_ok, res, NULL, msg ); } else{ @@ -923,28 +923,6 @@ static u64 seconds_to_server_ticks( double s ){ return s / 0.01; } -static void test_runner( db_request *req ){ -#if 0 - vg_warn( "RUNNER\n" ); - char table[DB_TABLE_UID_MAX]; - if( db_get_highscore_table_name( "sr002-local-mp_mtzero", - "Coastal Run", 0, 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 ); - } - } -#endif -} - -#define SIDELOAD -#ifdef SIDELOAD -#include "gameserver_sideload.h" -static int bsideload = 0; -const char *sideload_path = NULL; -#endif - int main( int argc, char *argv[] ){ signal( SIGINT, inthandler ); signal( SIGQUIT, inthandler ); @@ -954,35 +932,11 @@ int main( int argc, char *argv[] ){ while( vg_argp( argc, argv ) ){ if( vg_long_opt( "noauth" ) ) gameserver.auth_mode = eServerModeNoAuthentication; - -#ifdef SIDELOAD - if( (arg = vg_long_opt_arg( "sideload" )) ){ - sideload_path = arg; - bsideload = 1; - } -#endif } vg_set_mem_quota( 80*1024*1024 ); vg_alloc_quota(); - db_init(); - db_request *req = db_alloc_request(0); - if( req ){ - req->handler = test_runner; - db_send_request(req); - } - -#ifdef SIDELOAD - if( bsideload ){ - sideload( sideload_path ); - db_kill(); - db_free(); - return 0; - } -#endif - - monitor_start_server(); /* UNIX socket monitor */ /* steamworks init * --------------------------------------------------------------- */ @@ -1033,23 +987,15 @@ int main( int argc, char *argv[] ){ u64 server_ticks = 8000, last_record_save = 8000, - last_scoreboard_gen = 0, - last_monitor_heartbeat = 0; + last_scoreboard_gen = 0; while( !sig_stop ){ - monitor_event_loop(); steamworks_event_loop( hsteampipe ); poll_connections(); usleep(10000); server_ticks ++; - if( server_ticks > - (last_monitor_heartbeat + seconds_to_server_ticks(10.0))){ - last_monitor_heartbeat = server_ticks; - monitor_heartbeat(); - } - if( db_killed() ) break; }