Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // data_collector.cpp
  9. // Data collection system
  10. // Author: Michael S. Booth, June 2004
  11. #include "cbase.h"
  12. #include "data_collector.h"
  13. // NOTE: This has to be the last file included!
  14. #include "tier0/memdbgon.h"
  15. static CDataCollector *collector = NULL;
  16. //----------------------------------------------------------------------------------------------------------------------
  17. void StartDataCollection( void )
  18. {
  19. if (collector)
  20. {
  21. // already collecting
  22. return;
  23. }
  24. collector = new CDataCollector;
  25. Msg( "Data colletion started.\n" );
  26. }
  27. ConCommand data_collection_start( "data_collection_start", StartDataCollection, "Start collecting game event data." );
  28. //----------------------------------------------------------------------------------------------------------------------
  29. void StopDataCollection( void )
  30. {
  31. if (collector)
  32. {
  33. delete collector;
  34. collector = NULL;
  35. Msg( "Data collection stopped.\n" );
  36. }
  37. }
  38. ConCommand data_collection_stop( "data_collection_stop", StopDataCollection, "Stop collecting game event data." );
  39. //----------------------------------------------------------------------------------------------------------------------
  40. CDataCollector::CDataCollector( void )
  41. {
  42. // register for all events
  43. gameeventmanager->AddListener( this, true );
  44. }
  45. //----------------------------------------------------------------------------------------------------------------------
  46. CDataCollector::~CDataCollector()
  47. {
  48. gameeventmanager->RemoveListener( this );
  49. }
  50. //----------------------------------------------------------------------------------------------------------------------
  51. /**
  52. * This is invoked for each event that occurs in the game
  53. */
  54. void CDataCollector::FireGameEvent( KeyValues *event )
  55. {
  56. DevMsg( "Collected event '%s'\n", event->GetName() );
  57. }