networking
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#include "server.h"
|
||||
#include "engine.h"
|
||||
#include "input.h"
|
||||
#include "steam/steam_api_common.h"
|
||||
#include "tier1/commandline.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "baseentity.h"
|
||||
#include "console.h"
|
||||
#include "physics.h"
|
||||
#include "input.h"
|
||||
#include "net.h"
|
||||
#include "networking.h"
|
||||
|
||||
void *g_serverdll;
|
||||
ConVar g_tickrate("tickrate","64",FCVAR_PROTECTED);
|
||||
@@ -23,12 +25,14 @@ void IServer::LoadGame( const char *psz )
|
||||
#ifndef STATIC_BUILD
|
||||
#ifdef __linux__
|
||||
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/libserver.so", psz));
|
||||
Plat_LoadLibrary(CUtlString("%s/bin/libclient.so", psz));
|
||||
if (!ICommandLine::CheckParam("-dedicated"))
|
||||
Plat_LoadLibrary(CUtlString("%s/bin/libclient.so", psz));
|
||||
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/libserver.dysim", psz));
|
||||
Plat_LoadLibrary(CUtlString("%s/bin/libclient.dysim", psz));
|
||||
g_serverdll = Plat_LoadLibrary(CUtlString("%s/bin/libserver.dylib", psz));
|
||||
if (!ICommandLine::CheckParam("-dedicated"))
|
||||
Plat_LoadLibrary(CUtlString("%s/bin/libclient.dylib", psz));
|
||||
#endif
|
||||
void (*GameLoadfn)() = (void(*)())Plat_GetProc(g_serverdll, "IGame_Load");
|
||||
if (!GameLoadfn)
|
||||
@@ -50,13 +54,16 @@ void IServer::Think( float fDelta )
|
||||
/* tickrate */
|
||||
while(g_fAccumulator>=fTickrate)
|
||||
{
|
||||
#ifdef STEAM_ENABLED
|
||||
SteamGameServer_RunCallbacks();
|
||||
#endif
|
||||
IInput::Frame();
|
||||
IConsole::Execute();
|
||||
|
||||
g_fAccumulator-=fTickrate;
|
||||
for (auto &entity: g_entities)
|
||||
{
|
||||
entity->Think(fTickrate);
|
||||
entity->Sync(0, 0);
|
||||
}
|
||||
px_frame(px, fTickrate);
|
||||
}
|
||||
@@ -68,6 +75,7 @@ void IServer::Think( float fDelta )
|
||||
};
|
||||
|
||||
void IGame_Exit( int argc, char **argv ) {
|
||||
IEngine::Shutdown();
|
||||
Plat_Exit(0);
|
||||
}
|
||||
ConCommand ExitCmd("exit", IGame_Exit, 0);
|
||||
|
||||
Reference in New Issue
Block a user