blob: d2323b868df16b54935d4d014c63cd9517b3526c (
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// data_collector.cpp
// Data collection system
// Author: Michael S. Booth, June 2004
#include "cbase.h"
#include "data_collector.h"
static CDataCollector *collector = NULL;
//----------------------------------------------------------------------------------------------------------------------
void StartDataCollection( void )
{
if (collector)
{
// already collecting
return;
}
collector = new CDataCollector;
Msg( "Data colletion started.\n" );
}
ConCommand data_collection_start( "data_collection_start", StartDataCollection, "Start collecting game event data." );
//----------------------------------------------------------------------------------------------------------------------
void StopDataCollection( void )
{
if (collector)
{
delete collector;
collector = NULL;
Msg( "Data collection stopped.\n" );
}
}
ConCommand data_collection_stop( "data_collection_stop", StopDataCollection, "Stop collecting game event data." );
//----------------------------------------------------------------------------------------------------------------------
CDataCollector::CDataCollector( void )
{
// register for all events
gameeventmanager->AddListener( this, true );
}
//----------------------------------------------------------------------------------------------------------------------
CDataCollector::~CDataCollector()
{
gameeventmanager->RemoveListener( this );
}
//----------------------------------------------------------------------------------------------------------------------
/**
* This is invoked for each event that occurs in the game
*/
void CDataCollector::FireGameEvent( KeyValues *event )
{
DevMsg( "Collected event '%s'\n", event->GetName() );
}
|