X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=inline;f=network.h;h=3495c6a798a997f4cacc333d427ec9049f4e479c;hb=4fa9aa9a1e09940e91cc30e171e3de0606515ef3;hp=752c6c3c46534e7bf580b5a60ef2c3462e08323e;hpb=a7d144c7905105909cc4434e0ab43008bbb8f89f;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network.h b/network.h index 752c6c3..3495c6a 100644 --- a/network.h +++ b/network.h @@ -14,12 +14,9 @@ #define NETWORK_MAX_REQUESTS 8 -static int network_scores_updated = 0; - /* * Interface */ -//#define SR_USE_LOCALHOST /* Call it at start; Connects us to the gameserver */ static void network_init(void); @@ -56,21 +53,31 @@ struct { struct network_request { vg_pool_node poolnode; - void (*callback)( netmsg_request *res, vg_msg *body ); + void (*callback)( netmsg_request *res, vg_msg *body, u64 userdata ); f64 sendtime; + u64 userdata; } *request_buffer; vg_pool request_pool; + + char server_adress[64]; } static network_client = { .auth_mode = eServerModeAuthentication, .state = k_ESteamNetworkingConnectionState_None, + .server_adress = "46.101.34.155" }; static int packet_minsize( SteamNetworkingMessage_t *msg, u32 size ); static void network_send_item( enum netmsg_playeritem_type type ); static void network_request_scoreboard( const char *mod_uid, const char *route_uid, - u32 week ); + u32 week, u64 userdata ); +static void network_publish_laptime( const char *mod_uid, + const char *route_uid, f64 lap_time ); + +static int network_connected(void){ + return network_client.state == k_ESteamNetworkingConnectionState_Connected; +} #endif /* NETWORK_H */