fixed networking
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "mainmenu.h"
|
#include "mainmenu.h"
|
||||||
#include "networking.h"
|
#include "networking.h"
|
||||||
|
#include "steam/steam_api_common.h"
|
||||||
#include "tier0/network.h"
|
#include "tier0/network.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "tier1/commandline.h"
|
#include "tier1/commandline.h"
|
||||||
@@ -94,6 +95,11 @@ void IEngine::Init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STEAM_ENABLED
|
#ifdef STEAM_ENABLED
|
||||||
|
if(SteamAPI_RestartAppIfNecessary(480))
|
||||||
|
{
|
||||||
|
Plat_Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
SteamErrMsg err;
|
SteamErrMsg err;
|
||||||
if (SteamAPI_InitEx(&err) != k_ESteamAPIInitResult_OK)
|
if (SteamAPI_InitEx(&err) != k_ESteamAPIInitResult_OK)
|
||||||
{
|
{
|
||||||
@@ -143,6 +149,9 @@ void IEngine::Init()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IEngine::Frame(float fDelta)
|
void IEngine::Frame(float fDelta)
|
||||||
{
|
{
|
||||||
|
#ifdef STEAM_ENABLED
|
||||||
|
SteamAPI_RunCallbacks();
|
||||||
|
#endif
|
||||||
IServer::Think(fDelta);
|
IServer::Think(fDelta);
|
||||||
|
|
||||||
if (INetworking::IsClient())
|
if (INetworking::IsClient())
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ void INetworking::Init()
|
|||||||
#ifdef STEAMNETWORKINGSOCKETS_OPENSOURCE
|
#ifdef STEAMNETWORKINGSOCKETS_OPENSOURCE
|
||||||
GameNetworkingSockets_Init(NULL, &errMsg)
|
GameNetworkingSockets_Init(NULL, &errMsg)
|
||||||
#endif
|
#endif
|
||||||
|
V_printf("Cool\n");
|
||||||
if (ICommandLine::CheckParam("-steamdebug"))
|
if (ICommandLine::CheckParam("-steamdebug"))
|
||||||
{
|
{
|
||||||
SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg,
|
SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg,
|
||||||
@@ -113,7 +114,6 @@ void INetworking::Init()
|
|||||||
net_listenSocket = SteamGameServerNetworkingSockets()->CreateListenSocketP2P(0, 0, NULL);
|
net_listenSocket = SteamGameServerNetworkingSockets()->CreateListenSocketP2P(0, 0, NULL);
|
||||||
net_bIsServer = true;
|
net_bIsServer = true;
|
||||||
} else {
|
} else {
|
||||||
V_printf("Cool\n");
|
|
||||||
if (ICommandLine::ParamValue("-connect"))
|
if (ICommandLine::ParamValue("-connect"))
|
||||||
{
|
{
|
||||||
Console()->AddCommand(CUtlString("connect %s;", ICommandLine::ParamValue("-connect")));
|
Console()->AddCommand(CUtlString("connect %s;", ICommandLine::ParamValue("-connect")));
|
||||||
@@ -166,7 +166,6 @@ void INetworking::Frame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SteamNetworkingSockets()->RunCallbacks();
|
|
||||||
SteamNetworkingMessage_t *pMessages[64];
|
SteamNetworkingMessage_t *pMessages[64];
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ bind a +left;
|
|||||||
bind d +right;
|
bind d +right;
|
||||||
bind w +forward;
|
bind w +forward;
|
||||||
bind s +back;
|
bind s +back;
|
||||||
bind o connect 90271142097538072;
|
bind o connect 90271429367739416;
|
||||||
|
|||||||
Reference in New Issue
Block a user