improved server
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include "fgui/fgui.h"
|
||||
#include "input.h"
|
||||
#include "networking.h"
|
||||
#include "steam/isteamgameserver.h"
|
||||
#include "tier0/network.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/commandline.h"
|
||||
@@ -17,6 +16,7 @@
|
||||
#include "physics.h"
|
||||
#include "signal.h"
|
||||
#include "steam/steam_api.h"
|
||||
#include "steam/isteamgameserver.h"
|
||||
#include "steam/steam_gameserver.h"
|
||||
#include "networking.h"
|
||||
|
||||
@@ -109,14 +109,6 @@ void IEngine::Init()
|
||||
|
||||
if (!ICommandLine::CheckParam("-dedicated"))
|
||||
{
|
||||
#ifdef STEAM_ENABLED
|
||||
// Log in into steam
|
||||
if (!SteamUser()->BLoggedOn())
|
||||
{
|
||||
SteamAPI_Shutdown();
|
||||
Plat_FatalErrorFunc("User must be logged in to Steam");
|
||||
}
|
||||
#endif
|
||||
// Run local client
|
||||
g_localClient = new IIClient();
|
||||
IIEngine::ConnectClient(g_localClient);
|
||||
@@ -126,21 +118,7 @@ void IEngine::Init()
|
||||
IInput::Init();
|
||||
IInput::SetMouseMode(MOUSE_MODE_GAME);
|
||||
IFGUI::Init();
|
||||
} else {
|
||||
#ifdef STEAM_ENABLED
|
||||
// Run dedicated server with steam
|
||||
SteamGameServer_Init(0, 27015, 27016, eServerModeAuthentication, "0.0.0.0");
|
||||
SteamGameServer()->SetProduct("funnygame");
|
||||
SteamGameServer()->SetGameDescription("not that funny but ok");
|
||||
SteamGameServer()->SetModDir("funnygame");
|
||||
SteamGameServer()->SetDedicatedServer(true);
|
||||
|
||||
SteamGameServer()->LogOnAnonymous();
|
||||
int nMaxPlayers = atoi(ICommandLine::ParamValue("-maxplayers", "128"));
|
||||
SteamGameServer()->SetMaxPlayerCount(nMaxPlayers);
|
||||
SteamGameServer()->SetAdvertiseServerActive(true);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
INetworking::Init();
|
||||
|
||||
@@ -164,8 +142,8 @@ void IEngine::Frame(float fDelta)
|
||||
#ifdef STEAM_ENABLED
|
||||
SteamAPI_RunCallbacks();
|
||||
#endif
|
||||
INetworking::Frame();
|
||||
IServer::Think(fDelta);
|
||||
INetworking::Frame();
|
||||
if (!ICommandLine::CheckParam("-dedicated"))
|
||||
{
|
||||
IFGUI::Frame();
|
||||
|
||||
Reference in New Issue
Block a user