r5sdk/r5dev/server/vengineserver_impl.cpp
Kawe Mazidjatari 4b72afb74f Light refactor for logging
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.
2022-05-25 14:18:29 +02:00

55 lines
2.2 KiB
C++

//=============================================================================//
//
// Purpose: Interface the engine exposes to the game DLL
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier1/cvar.h"
#include "common/protocol.h"
#include "engine/client/client.h"
#include "server/vengineserver_impl.h"
//-----------------------------------------------------------------------------
// Purpose: sets the persistence var in the CClient instance to 'ready'
//-----------------------------------------------------------------------------
bool HIVEngineServer__PersistenceAvailable(void* entidx, int clienthandle)
{
CClient* pClient = g_pClient->GetClient(clienthandle); // Get client instance.
pClient->SetPersistenceState(PERSISTENCE::PERSISTENCE_READY); // Set the client instance to 'ready'.
if (!g_bIsPersistenceVarSet[clienthandle] && sv_showconnecting->GetBool())
{
CNetChan* pNetChan = pClient->GetNetChan();
string svClientName = pNetChan->GetName();
string svIpAddress = pNetChan->GetAddress();
int64_t nOriginID = pClient->GetOriginID();
DevMsg(eDLL_T::SERVER, "______________________________________________________________\n");
DevMsg(eDLL_T::SERVER, "+- NetChannel:\n");
DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clienthandle);
DevMsg(eDLL_T::SERVER, " |- UID : | '%s'\n", svClientName.c_str());
DevMsg(eDLL_T::SERVER, " |- OID : | '%lld'\n", nOriginID);
DevMsg(eDLL_T::SERVER, " |- ADR : | '%s'\n", svIpAddress.c_str());
DevMsg(eDLL_T::SERVER, " -------------------------------------------------------------\n");
g_bIsPersistenceVarSet[clienthandle] = true;
}
///////////////////////////////////////////////////////////////////////////
return IVEngineServer__PersistenceAvailable(entidx, clienthandle);
}
void IVEngineServer_Attach()
{
DetourAttach((LPVOID*)&IVEngineServer__PersistenceAvailable, &HIVEngineServer__PersistenceAvailable);
}
void IVEngineServer_Detach()
{
DetourDetach((LPVOID*)&IVEngineServer__PersistenceAvailable, &HIVEngineServer__PersistenceAvailable);
}
///////////////////////////////////////////////////////////////////////////////
bool g_bIsPersistenceVarSet[MAX_PLAYERS];