From f56bb35301836e56582a575a75864392a0177875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 2 Dec 2013 19:31:46 -0800 Subject: Fix line endings. WHAMMY. --- mp/src/game/shared/test_ehandle.cpp | 250 ++++++++++++++++++------------------ 1 file changed, 125 insertions(+), 125 deletions(-) (limited to 'mp/src/game/shared/test_ehandle.cpp') diff --git a/mp/src/game/shared/test_ehandle.cpp b/mp/src/game/shared/test_ehandle.cpp index 42f27ba2..3e5a0d2b 100644 --- a/mp/src/game/shared/test_ehandle.cpp +++ b/mp/src/game/shared/test_ehandle.cpp @@ -1,125 +1,125 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -// -//=============================================================================// - -#include "cbase.h" - -// memdbgon must be the last include file in a .cpp file!!! -#include "tier0/memdbgon.h" - -// In this test, the server makes an entity (call it A) that has an EHANDLE to another -// entity (call it B). Intitially, A is sent to the client but B is not. Later, -// the server decides to send B to the client too. At that point, without resending A's EHANDLE, -// the client's EHANDLE should access B. - -#if defined( GAME_DLL ) - - // ------------------------------------------------------------------------------------ // - // The main entity class (class A). - // ------------------------------------------------------------------------------------ // - class CHandleTest : public CBaseEntity - { - public: - DECLARE_CLASS( CHandleTest, CBaseEntity ); - DECLARE_SERVERCLASS(); - - CHandleTest() - { - m_bSendHandle = false; - } - - virtual int UpdateTransmitState() - { - // ALWAYS transmit to all clients. - return SetTransmitState( FL_EDICT_ALWAYS ); - } - - virtual void SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways ) - { - if ( pInfo->m_pTransmitEdict->Get( entindex() ) ) - return; - - BaseClass::SetTransmit( pInfo, bAlways ); - - // Force the thing we're pointing at to be sent too? - if ( m_bSendHandle ) - m_Handle->SetTransmit( pInfo, bAlways ); - } - - CNetworkHandle( CBaseEntity, m_Handle ); - CNetworkVar( bool, m_bSendHandle ); - }; - - IMPLEMENT_SERVERCLASS_ST( CHandleTest, DT_HandleTest ) - SendPropEHandle( SENDINFO( m_Handle ) ), - SendPropInt( SENDINFO( m_bSendHandle ) ) - END_SEND_TABLE() - - LINK_ENTITY_TO_CLASS( handle_test, CHandleTest ); - - - // ------------------------------------------------------------------------------------ // - // The class pointed to by the handle. - // ------------------------------------------------------------------------------------ // - class CHandleDummy : public CBaseEntity - { - DECLARE_CLASS( CHandleDummy, CBaseEntity ); - public: - }; - LINK_ENTITY_TO_CLASS( handle_dummy, CHandleDummy ); - - CHandle g_HandleTest; - - // The test runs this command. - void CC_Test_EHandle() - { - if ( g_HandleTest.Get() ) - { - g_HandleTest->m_bSendHandle = !g_HandleTest->m_bSendHandle; - } - else - { - CHandleTest *pHolder = CREATE_ENTITY( CHandleTest, "handle_test" ); - pHolder->m_Handle = CREATE_ENTITY( CHandleDummy, "handle_dummy" ); - pHolder->Spawn(); - g_HandleTest = pHolder; - Msg( "Created EHANDLE test entity. Run this command again to transmit the second ent.\n" ); - } - } - ConCommand Test_EHandle( "Test_EHandle", CC_Test_EHandle, 0, FCVAR_CHEAT ); - - -#else - - class C_HandleTest : public C_BaseEntity - { - public: - DECLARE_CLASS( C_HandleTest, C_BaseEntity ); - DECLARE_CLIENTCLASS(); - - C_HandleTest() - { - } - - virtual void OnDataChanged( DataUpdateType_t type ) - { - Msg( "m_bSendHandle: %d, m_Handle.Get: 0x%p\n", m_bSendHandle, m_Handle.Get() ); - } - - EHANDLE m_Handle; - bool m_bSendHandle; - }; - - IMPLEMENT_CLIENTCLASS_DT( C_HandleTest, DT_HandleTest, CHandleTest ) - RecvPropEHandle( RECVINFO( m_Handle ) ), - RecvPropInt( RECVINFO( m_bSendHandle ) ) - END_RECV_TABLE() - - -#endif - - +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#include "cbase.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +// In this test, the server makes an entity (call it A) that has an EHANDLE to another +// entity (call it B). Intitially, A is sent to the client but B is not. Later, +// the server decides to send B to the client too. At that point, without resending A's EHANDLE, +// the client's EHANDLE should access B. + +#if defined( GAME_DLL ) + + // ------------------------------------------------------------------------------------ // + // The main entity class (class A). + // ------------------------------------------------------------------------------------ // + class CHandleTest : public CBaseEntity + { + public: + DECLARE_CLASS( CHandleTest, CBaseEntity ); + DECLARE_SERVERCLASS(); + + CHandleTest() + { + m_bSendHandle = false; + } + + virtual int UpdateTransmitState() + { + // ALWAYS transmit to all clients. + return SetTransmitState( FL_EDICT_ALWAYS ); + } + + virtual void SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways ) + { + if ( pInfo->m_pTransmitEdict->Get( entindex() ) ) + return; + + BaseClass::SetTransmit( pInfo, bAlways ); + + // Force the thing we're pointing at to be sent too? + if ( m_bSendHandle ) + m_Handle->SetTransmit( pInfo, bAlways ); + } + + CNetworkHandle( CBaseEntity, m_Handle ); + CNetworkVar( bool, m_bSendHandle ); + }; + + IMPLEMENT_SERVERCLASS_ST( CHandleTest, DT_HandleTest ) + SendPropEHandle( SENDINFO( m_Handle ) ), + SendPropInt( SENDINFO( m_bSendHandle ) ) + END_SEND_TABLE() + + LINK_ENTITY_TO_CLASS( handle_test, CHandleTest ); + + + // ------------------------------------------------------------------------------------ // + // The class pointed to by the handle. + // ------------------------------------------------------------------------------------ // + class CHandleDummy : public CBaseEntity + { + DECLARE_CLASS( CHandleDummy, CBaseEntity ); + public: + }; + LINK_ENTITY_TO_CLASS( handle_dummy, CHandleDummy ); + + CHandle g_HandleTest; + + // The test runs this command. + void CC_Test_EHandle() + { + if ( g_HandleTest.Get() ) + { + g_HandleTest->m_bSendHandle = !g_HandleTest->m_bSendHandle; + } + else + { + CHandleTest *pHolder = CREATE_ENTITY( CHandleTest, "handle_test" ); + pHolder->m_Handle = CREATE_ENTITY( CHandleDummy, "handle_dummy" ); + pHolder->Spawn(); + g_HandleTest = pHolder; + Msg( "Created EHANDLE test entity. Run this command again to transmit the second ent.\n" ); + } + } + ConCommand Test_EHandle( "Test_EHandle", CC_Test_EHandle, 0, FCVAR_CHEAT ); + + +#else + + class C_HandleTest : public C_BaseEntity + { + public: + DECLARE_CLASS( C_HandleTest, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + + C_HandleTest() + { + } + + virtual void OnDataChanged( DataUpdateType_t type ) + { + Msg( "m_bSendHandle: %d, m_Handle.Get: 0x%p\n", m_bSendHandle, m_Handle.Get() ); + } + + EHANDLE m_Handle; + bool m_bSendHandle; + }; + + IMPLEMENT_CLIENTCLASS_DT( C_HandleTest, DT_HandleTest, CHandleTest ) + RecvPropEHandle( RECVINFO( m_Handle ) ), + RecvPropInt( RECVINFO( m_bSendHandle ) ) + END_RECV_TABLE() + + +#endif + + -- cgit v1.2.3