X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=network.h;h=dd6adc0c25f0faab87237f5415b9a230bf370934;hb=6e6c7f31b8f17af3814727109e48fc6f85ef04b1;hp=fc4829d6d1bb3468fb0db3595aaf867be63ad814;hpb=1d8d9366022c064ef56d80d463c90a79721c6243;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network.h b/network.h index fc4829d..dd6adc0 100644 --- a/network.h +++ b/network.h @@ -8,6 +8,7 @@ #include "vg/vg_stdint.h" #include "steam.h" +#include "network_common.h" #include "network_msg.h" #include "highscores.h" #include "addon_types.h" @@ -17,7 +18,6 @@ /* * Interface */ -//#define SR_USE_LOCALHOST /* Call it at start; Connects us to the gameserver */ static void network_init(void); @@ -46,6 +46,7 @@ struct { HSteamNetConnection remote; ESteamNetworkingConnectionState state; + u32 remote_version; f64 last_attempt, last_frame; u32 retries; @@ -60,10 +61,22 @@ struct { } *request_buffer; vg_pool request_pool; + + char server_adress[64]; + + enum server_intent { + k_server_intent_offline, + k_server_intent_online + } + user_intent; + f64 last_intent_change; + f32 fintent; /* yeah this shit really shouldnt be here but oh well */ } static network_client = { .auth_mode = eServerModeAuthentication, .state = k_ESteamNetworkingConnectionState_None, + .server_adress = "46.101.34.155", + .last_intent_change = -99999.9 }; static int packet_minsize( SteamNetworkingMessage_t *msg, u32 size ); @@ -73,5 +86,14 @@ static void network_request_scoreboard( const char *mod_uid, u32 week, u64 userdata ); static void network_publish_laptime( const char *mod_uid, const char *route_uid, f64 lap_time ); +static void chat_send_message( const char *message ); +static void render_server_status_gui(void); +static void network_status_string( vg_str *str, u32 *colour ); +static void network_send_region(void); + +static int network_connected(void){ + if( network_client.remote_version != NETWORK_SKATERIFT_VERSION ) return 0; + return network_client.state == k_ESteamNetworkingConnectionState_Connected; +} #endif /* NETWORK_H */