aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/base_transmit_proxy.cpp
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/server/base_transmit_proxy.cpp
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/server/base_transmit_proxy.cpp')
-rw-r--r--sp/src/game/server/base_transmit_proxy.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/sp/src/game/server/base_transmit_proxy.cpp b/sp/src/game/server/base_transmit_proxy.cpp
new file mode 100644
index 00000000..b0151eb8
--- /dev/null
+++ b/sp/src/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;
+ }
+}
+