aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/c_test_proxytoggle.cpp
blob: 45405e10812dbafb6a6d673a4bf2fcfae91cb12a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "c_baseentity.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

class C_Test_ProxyToggle_Networkable;
static C_Test_ProxyToggle_Networkable *g_pTestObj = 0;


// ---------------------------------------------------------------------------------------- //
// C_Test_ProxyToggle_Networkable
// ---------------------------------------------------------------------------------------- //

class C_Test_ProxyToggle_Networkable : public C_BaseEntity
{
public:
	DECLARE_CLASS( C_Test_ProxyToggle_Networkable, C_BaseEntity );
	DECLARE_CLIENTCLASS();

			C_Test_ProxyToggle_Networkable()
			{
				g_pTestObj = this;
			}

			~C_Test_ProxyToggle_Networkable()
			{
				g_pTestObj = 0;
			}

	int		m_WithProxy;
};


// ---------------------------------------------------------------------------------------- //
// Datatables.
// ---------------------------------------------------------------------------------------- //

BEGIN_RECV_TABLE_NOBASE( C_Test_ProxyToggle_Networkable, DT_ProxyToggle_ProxiedData )
	RecvPropInt( RECVINFO( m_WithProxy ) )
END_RECV_TABLE()

IMPLEMENT_CLIENTCLASS_DT( C_Test_ProxyToggle_Networkable, DT_ProxyToggle, CTest_ProxyToggle_Networkable )
	RecvPropDataTable( "blah", 0, 0, &REFERENCE_RECV_TABLE( DT_ProxyToggle_ProxiedData ) )
END_RECV_TABLE()



// ---------------------------------------------------------------------------------------- //
// Console commands.
// ---------------------------------------------------------------------------------------- //

// The engine uses this to get the current value.
CON_COMMAND_F( Test_ProxyToggle_EnsureValue, "Test_ProxyToggle_EnsureValue", FCVAR_CHEAT )
{
	if ( args.ArgC() < 2 )
	{
		Error( "Test_ProxyToggle_EnsureValue: requires value parameter." );
	}
	else if ( !g_pTestObj )
	{
		Error( "Test_ProxyToggle_EnsureValue: object doesn't exist on the client." );
	}

	int wantedValue = atoi( args[ 1 ] );
	if ( g_pTestObj->m_WithProxy != wantedValue )
	{
		Error( "Test_ProxyToggle_EnsureValue: value (%d) doesn't match wanted value (%d).", g_pTestObj->m_WithProxy, wantedValue );
	}
}