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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#include "managertest.h"
#include "replay/replayutils.h"
#include "cl_replaycontext.h"
#include "KeyValues.h"
#include "replay/shared_defs.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#if _DEBUG
//----------------------------------------------------------------------------------------
#define TESTMANAGER_VERSION 0
#define SUBDIR_TEST "test"
//----------------------------------------------------------------------------------------
const char *Test_GetPath()
{
return Replay_va( "%s%c%s%c%s%c", g_pEngine->GetGameDir(), CORRECT_PATH_SEPARATOR, SUBDIR_REPLAY, CORRECT_PATH_SEPARATOR, SUBDIR_TEST, CORRECT_PATH_SEPARATOR );
}
//----------------------------------------------------------------------------------------
CTestObj::CTestObj()
: m_nTest( -1 )
{
m_strTest = "";
m_pTest = new int;
}
CTestObj::~CTestObj()
{
delete m_pTest;
}
const char *CTestObj::GetSubKeyTitle() const
{
return Replay_va( "test_%i", GetHandle() );
}
const char *CTestObj::GetPath() const
{
return Test_GetPath();
}
void CTestObj::OnDelete()
{
}
bool CTestObj::Read( KeyValues *pIn )
{
if ( !BaseClass::Read( pIn ) )
return false;
m_nTest = pIn->GetInt( "int_test", -1 );
m_strTest = pIn->GetString( "int_test" );
return true;
}
void CTestObj::Write( KeyValues *pOut )
{
BaseClass::Write( pOut );
pOut->SetInt( "int_test", m_nTest );
pOut->SetString( "str_test", m_strTest.Get() );
}
//----------------------------------------------------------------------------------------
/*static*/ void CTestManager::Test()
{
#if 0
CUtlLinkedList< CTestObj *, int > lstTest;
CTestObj test;
lstTest.AddToTail( &test );
lstTest.RemoveAll();
CTestManager m;
m.Init();
for ( int i = 0; i < 3; ++i )
{
CTestObj *pNewObj = m.CreateAndGenerateHandle();
m.Add( pNewObj );
}
m.Shutdown();
#endif
}
CTestManager::CTestManager()
{
}
const char *CTestManager::GetIndexPath() const
{
return Test_GetPath();
}
int CTestManager::GetVersion() const
{
return TESTMANAGER_VERSION;
}
CTestObj *CTestManager::Create()
{
return new CTestObj();
}
#endif
//----------------------------------------------------------------------------------------
|