diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/eventlist.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/tfstats/eventlist.cpp')
| -rw-r--r-- | utils/tfstats/eventlist.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/utils/tfstats/eventlist.cpp b/utils/tfstats/eventlist.cpp new file mode 100644 index 0000000..87d9087 --- /dev/null +++ b/utils/tfstats/eventlist.cpp @@ -0,0 +1,61 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implementation of CEventList +// +// $Workfile: $ +// $Date: $ +// +//------------------------------------------------------------------------------------------------------ +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include <stdlib.h> +#include "TFStatsApplication.h" +#include "EventList.h" +#include "memdbg.h" + +#pragma warning (disable : 4786) +//------------------------------------------------------------------------------------------------------ +// Function: CEventList::readEventList +// Purpose: reads and returns a CEventList from a logfile +// Input: filename - the logfile to read from +// Output: CEventList* +//------------------------------------------------------------------------------------------------------ +CEventList* CEventList::readEventList(const char* filename) +{ + + // ifstream ifs(filename); + CEventList* plogfile=new TRACKED CEventList(); + if (!plogfile) + { + printf("TFStats ran out of memory!\n"); + return NULL; + } + + + FILE* f=fopen(filename,"rt"); + if (!f) + g_pApp->fatalError("Error opening %s, please make sure that the file exists and is not being accessed by other processes",filename); + + while (!feof(f)) + { + CLogEvent* curr=NULL; + curr=new TRACKED CLogEvent(f); + + if (!curr->isValid()) + { + delete curr; + break;//eof reached + } + plogfile->insert(plogfile->end(),curr); + } + fclose(f); +#ifndef WIN32 + chmod(filename,PERMIT); +#endif + + return plogfile; + +} + |