X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=blobdiff_plain;f=vg_steam_networking.h;h=6eb059909d261274abe9321572f935140b0fed68;hp=a2745758d5b8b18340c08add692a8a4d2d38f042;hb=HEAD;hpb=81c1746e8550682b581548e262660271b5d4d6dd diff --git a/vg_steam_networking.h b/vg_steam_networking.h index a274575..5abb7b6 100644 --- a/vg_steam_networking.h +++ b/vg_steam_networking.h @@ -1,6 +1,4 @@ -#ifndef VG_STEAM_NETWORKING_H -#define VG_STEAM_NETWORKING_H - +#pragma once #include "vg_steam.h" #ifdef VALVE_CALLBACK_PACK_SMALL @@ -183,7 +181,7 @@ typedef enum ESteamNetworkingAvailability ESteamNetworkingAvailability; /* Handle used to identify a connection to a remote host. */ typedef u32 HSteamNetConnection; -HSteamNetConnection const k_HSteamNetConnection_Invalid = 0; +static HSteamNetConnection const k_HSteamNetConnection_Invalid = 0; /* * Handle used to identify a "listen socket". Unlike traditional @@ -191,7 +189,7 @@ HSteamNetConnection const k_HSteamNetConnection_Invalid = 0; * different abstractions. */ typedef u32 HSteamListenSocket; -HSteamListenSocket const k_HSteamListenSocket_Invalid = 0; +static HSteamListenSocket const k_HSteamListenSocket_Invalid = 0; typedef u32 SteamNetworkingPOPID; typedef i64 SteamNetworkingMicroseconds; @@ -393,12 +391,12 @@ typedef struct SteamNetConnectionInfo_t SteamNetConnectionInfo_t; * connections at once efficiently. */ typedef u32 HSteamNetPollGroup; -HSteamNetPollGroup const k_HSteamNetPollGroup_Invalid = 0; +static HSteamNetPollGroup const k_HSteamNetPollGroup_Invalid = 0; ISteamNetworkingSockets *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012(void); -ISteamNetworkingSockets +static inline ISteamNetworkingSockets *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI(void) { return SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012(); @@ -406,6 +404,7 @@ ISteamNetworkingSockets ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI_v012(); +static inline ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI() { return SteamAPI_SteamNetworkingSockets_SteamAPI_v012(); @@ -425,7 +424,7 @@ ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI() * Migration note: This is not exactly the same as k_EP2PSendUnreliable! You * probably want k_ESteamNetworkingSendType_UnreliableNoNagle */ -const int k_nSteamNetworkingSend_Unreliable = 0; +static const int k_nSteamNetworkingSend_Unreliable = 0; /* * Disable Nagle's algorithm. @@ -446,7 +445,7 @@ const int k_nSteamNetworkingSend_Unreliable = 0; * server simulation tick to a particular client), and you use this flag to * flush all messages. */ -const int k_nSteamNetworkingSend_NoNagle = 1; +static const int k_nSteamNetworkingSend_NoNagle = 1; /* * Send a message unreliably, bypassing Nagle's algorithm for this message and @@ -456,7 +455,7 @@ const int k_nSteamNetworkingSend_NoNagle = 1; * ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more * efficient since you only make one API call.) */ -const int k_nSteamNetworkingSend_UnreliableNoNagle = +static const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoNagle; /* @@ -465,7 +464,7 @@ const int k_nSteamNetworkingSend_UnreliableNoNagle = * This is only applicable for unreliable messages. Using this flag on reliable * messages is invalid. */ -const int k_nSteamNetworkingSend_NoDelay = 4; +static const int k_nSteamNetworkingSend_NoDelay = 4; /* * Send an unreliable message, but if it cannot be sent relatively quickly, just @@ -483,7 +482,7 @@ const int k_nSteamNetworkingSend_NoDelay = 4; * * If a message is dropped for these reasons, k_EResultIgnored will be returned. */ -const int k_nSteamNetworkingSend_UnreliableNoDelay = +static const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoDelay | k_nSteamNetworkingSend_NoNagle; @@ -502,14 +501,14 @@ const int k_nSteamNetworkingSend_UnreliableNoDelay = * Migration note: This is NOT the same as k_EP2PSendReliable, it's more like * k_EP2PSendReliableWithBuffering */ -const int k_nSteamNetworkingSend_Reliable = 8; +static const int k_nSteamNetworkingSend_Reliable = 8; /* * Send a message reliably, but bypass Nagle's algorithm. * * Migration note: This is equivalent to k_EP2PSendReliable */ -const int k_nSteamNetworkingSend_ReliableNoNagle = +static const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable | k_nSteamNetworkingSend_NoNagle; @@ -933,12 +932,14 @@ void SteamAPI_SteamNetworkingMessage_t_Release(SteamNetworkingMessage_t* self); * Utility */ -static const char *string_ESteamNetworkingConnectionState( +static inline const char *string_ESteamNetworkingConnectionState( ESteamNetworkingConnectionState s ) { switch(s) { - case k_ESteamNetworkingConnectionState_None: return "None"; break; + case k_ESteamNetworkingConnectionState_None: + return "None"; + break; case k_ESteamNetworkingConnectionState_Connecting: return "Connecting"; break; @@ -971,7 +972,7 @@ static const char *string_ESteamNetworkingConnectionState( return "Error"; } -static const char *string_ESteamNetworkingAvailability( +static inline const char *string_ESteamNetworkingAvailability( ESteamNetworkingAvailability s ) { switch(s) @@ -1008,5 +1009,3 @@ static const char *string_ESteamNetworkingAvailability( break; } } - -#endif /* VG_STEAM_NETWORKING_H */