Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "base_transmit_proxy.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. CBaseTransmitProxy::CBaseTransmitProxy( CBaseEntity *pEnt )
  11. {
  12. m_hEnt = pEnt;
  13. m_refCount = 0;
  14. }
  15. CBaseTransmitProxy::~CBaseTransmitProxy()
  16. {
  17. // Unlink from our parent entity.
  18. if ( m_hEnt )
  19. {
  20. m_refCount = 0xFFFF; // Prevent us from deleting ourselves again.
  21. // m_hEnt->NetworkProp()->SetTransmitProxy( NULL );
  22. }
  23. }
  24. int CBaseTransmitProxy::ShouldTransmit( const CCheckTransmitInfo *pInfo, int nPrevShouldTransmitResult )
  25. {
  26. // Anyone implementing a transmit proxy should override this since that's the point!!
  27. Assert( false );
  28. return FL_EDICT_DONTSEND;
  29. }
  30. void CBaseTransmitProxy::AddRef()
  31. {
  32. m_refCount++;
  33. }
  34. void CBaseTransmitProxy::Release()
  35. {
  36. if ( m_refCount == 0xFFFF )
  37. {
  38. // This means we are inside our destructor already, so we don't want to do anything here.
  39. }
  40. else if ( m_refCount <= 1 )
  41. {
  42. delete this;
  43. }
  44. else
  45. {
  46. --m_refCount;
  47. }
  48. }