From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- game/server/base_transmit_proxy.cpp | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 game/server/base_transmit_proxy.cpp (limited to 'game/server/base_transmit_proxy.cpp') diff --git a/game/server/base_transmit_proxy.cpp b/game/server/base_transmit_proxy.cpp new file mode 100644 index 0000000..4832af8 --- /dev/null +++ b/game/server/base_transmit_proxy.cpp @@ -0,0 +1,60 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "base_transmit_proxy.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +CBaseTransmitProxy::CBaseTransmitProxy( CBaseEntity *pEnt ) +{ + m_hEnt = pEnt; + m_refCount = 0; +} + + +CBaseTransmitProxy::~CBaseTransmitProxy() +{ + // Unlink from our parent entity. + if ( m_hEnt ) + { + m_refCount = 0xFFFF; // Prevent us from deleting ourselves again. + // m_hEnt->NetworkProp()->SetTransmitProxy( NULL ); + } +} + + +int CBaseTransmitProxy::ShouldTransmit( const CCheckTransmitInfo *pInfo, int nPrevShouldTransmitResult ) +{ + // Anyone implementing a transmit proxy should override this since that's the point!! + Assert( false ); + return FL_EDICT_DONTSEND; +} + + +void CBaseTransmitProxy::AddRef() +{ + m_refCount++; +} + + +void CBaseTransmitProxy::Release() +{ + if ( m_refCount == 0xFFFF ) + { + // This means we are inside our destructor already, so we don't want to do anything here. + } + else if ( m_refCount <= 1 ) + { + delete this; + } + else + { + --m_refCount; + } +} + -- cgit v1.2.3