aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/shared/test_ehandle.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /sp/src/game/shared/test_ehandle.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/game/shared/test_ehandle.cpp')
-rw-r--r--sp/src/game/shared/test_ehandle.cpp250
1 files changed, 125 insertions, 125 deletions
diff --git a/sp/src/game/shared/test_ehandle.cpp b/sp/src/game/shared/test_ehandle.cpp
index 42f27ba2..3e5a0d2b 100644
--- a/sp/src/game/shared/test_ehandle.cpp
+++ b/sp/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<CHandleTest> 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<CHandleTest> 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
+
+