Skip to content

Commit

Permalink
Implement ENABLE_NETWORKING macro
Browse files Browse the repository at this point in the history
  • Loading branch information
angguss committed Jul 14, 2018
1 parent 3eeb03c commit 298bec8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
#include "procedural/Noise.h"
#include "plugin_framework/XLEngine_Plugin_API.h"
#include "plugin_framework/PluginManager.h"
#if defined(ENABLE_NETWORKING)
#include "networking/NetworkMgr.h"
#endif
#include "math/Math.h"
#include "PluginAPI_Func.h"

Expand Down Expand Up @@ -231,6 +233,7 @@ bool Engine::Init(void **winParam, int32_t paramCnt, int32_t w, int32_t h)
m_nWidth = w;
m_nHeight = h;

#if defined(ENABLE_NETWORKING)
if ( settings.IsServer() || settings.IsClient_MP() )
{
uint32_t uWaitFrame = 0;
Expand Down Expand Up @@ -320,6 +323,7 @@ bool Engine::Init(void **winParam, int32_t paramCnt, int32_t w, int32_t h)
};
}
}
#endif
SetupPluginAPI();

return true;
Expand All @@ -331,7 +335,9 @@ void Engine::Destroy()

if ( settings.IsServer() || settings.IsClient_MP() )
{
#if defined(ENABLE_NETWORKING)
NetworkMgr::Destroy();
#endif
}

if ( m_pCamera )
Expand Down Expand Up @@ -762,8 +768,10 @@ bool Engine::Loop(float fDeltaTime, bool bFullspeed)
m_fTotalTime += fDeltaTime*m_fFixedLoopsPerSec;
while (m_fTotalTime >= 1.0f)
{
#if defined(ENABLE_NETWORKING)
//networking - which also occurs at 60fps.
NetworkMgr::Loop();
#endif

//Game specific update.
m_pGameUpdate( UPDATE_STAGE_FIXED, m_fFixedLoopTime, m_pPluginAPI, m_pGameUpdate_UD );
Expand Down
4 changes: 4 additions & 0 deletions ui/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include "../render/IDriver3D.h"
#include "../render/FontManager.h"
#include "../render/TextureCache.h"
#if defined(ENABLE_NETWORKING)
#include "../networking/NetworkMgr.h"
#endif
#include "../os/Input.h"
#include "../math/Math.h"

Expand Down Expand Up @@ -170,6 +172,7 @@ void Console::PassEnter()
{
if ( m_bActive == false )
{
#if defined(ENABLE_NETWORKING)
if ( Input::LockMouse() )
{
if ( m_bChatMode == true )
Expand All @@ -180,6 +183,7 @@ void Console::PassEnter()
}
m_bChatMode = !m_bChatMode;
}
#endif
return;
}

Expand Down
4 changes: 4 additions & 0 deletions win/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include "../Engine.h"
#include "../OS/Input.h"
#include "../OS/Clock.h"
#if defined(ENABLE_NETWORKING)
#include "../networking/NetworkMgr.h"
#endif
#include "../EngineSettings.h"

#ifndef WM_XBUTTONDOWN
Expand Down Expand Up @@ -176,7 +178,9 @@ int main(int argc, char *argv[])
{
strcpy(szPlayerName, "Default_Player");
}
#if defined(ENABLE_NETWORKING)
NetworkMgr::SetLocalPlayerName(szPlayerName);
#endif

//Engine settings.
EngineSettings &settings = EngineSettings::get();
Expand Down

0 comments on commit 298bec8

Please sign in to comment.