BVB Source Codes

CRYENGINE Show GameClientNub.cpp Source code

Return Download CRYENGINE: download GameClientNub.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.  
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 24:8:2004   10:58 : Created by M谩rcio Martins
  11.  
  12. *************************************************************************/
  13. #include "StdAfx.h"
  14. #include "CryAction.h"
  15. #include "GameContext.h"
  16. #include "GameClientNub.h"
  17. #include "GameClientChannel.h"
  18.  
  19. CGameClientNub::~CGameClientNub()
  20. {
  21.         delete m_pClientChannel;
  22. }
  23.  
  24. void CGameClientNub::Release()
  25. {
  26.         // don't delete because it's not dynamically allocated
  27. }
  28.  
  29. SCreateChannelResult CGameClientNub::CreateChannel(INetChannel* pChannel, const char* pRequest)
  30. {
  31.         if (pRequest)
  32.         {
  33.                 GameWarning("CGameClientNub::CreateChannel: pRequest is non-null, it should not be");
  34.                 CRY_ASSERT(false);
  35.                 SCreateChannelResult res(eDC_GameError);
  36.                 cry_strcpy(res.errorMsg, "CGameClientNub::CreateChannel: pRequest is non-null, it should not be");
  37.                 return res;
  38.         }
  39.  
  40.         if (m_pClientChannel)
  41.         {
  42.                 GameWarning("CGameClientNub::CreateChannel: m_pClientChannel is non-null, it should not be");
  43.                 CRY_ASSERT(false);
  44.                 SCreateChannelResult res(eDC_GameError);
  45.                 cry_strcpy(res.errorMsg, "CGameClientNub::CreateChannel: m_pClientChannel is non-null, it should not be");
  46.                 return res;
  47.         }
  48.  
  49.         if (CCryAction::GetCryAction()->IsGameSessionMigrating())
  50.         {
  51.                 pChannel->SetMigratingChannel(true);
  52.         }
  53.  
  54.         m_pClientChannel = new CGameClientChannel(pChannel, m_pGameContext, this);
  55.  
  56.         ICVar* pPass = gEnv->pConsole->GetCVar("sv_password");
  57.         if (pPass && gEnv->bMultiplayer)
  58.                 pChannel->SetPassword(pPass->GetString());
  59.  
  60.         return SCreateChannelResult(m_pClientChannel);
  61. }
  62.  
  63. void CGameClientNub::FailedActiveConnect(EDisconnectionCause cause, const char* description)
  64. {
  65.         GameWarning("Failed connecting to server: %s", description);
  66.         CCryAction::GetCryAction()->OnActionEvent(SActionEvent(eAE_connectFailed, int(cause), description));
  67. }
  68.  
  69. void CGameClientNub::Disconnect(EDisconnectionCause cause, const char* msg)
  70. {
  71.         if (m_pClientChannel)
  72.                 m_pClientChannel->GetNetChannel()->Disconnect(cause, msg);
  73. }
  74.  
  75. void CGameClientNub::ClientChannelClosed()
  76. {
  77.         CRY_ASSERT(m_pClientChannel);
  78.         m_pClientChannel = NULL;
  79. }
  80.  
  81. void CGameClientNub::GetMemoryUsage(ICrySizer* s) const
  82. {
  83.         s->Add(*this);
  84.         if (m_pClientChannel)
  85.                 m_pClientChannel->GetMemoryStatistics(s);
  86. }
  87.  
downloadGameClientNub.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top