summaryrefslogtreecommitdiff
path: root/utils/tfstats/allplayersstats.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/allplayersstats.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/tfstats/allplayersstats.cpp')
-rw-r--r--utils/tfstats/allplayersstats.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/utils/tfstats/allplayersstats.cpp b/utils/tfstats/allplayersstats.cpp
new file mode 100644
index 0000000..c4b05cc
--- /dev/null
+++ b/utils/tfstats/allplayersstats.cpp
@@ -0,0 +1,119 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Implementation of CAllPlayersStats
+//
+// $Workfile: $
+// $Date: $
+//
+//------------------------------------------------------------------------------------------------------
+// $Log: $
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "AllPlayersStats.h"
+#include "PlayerReport.h"
+#include "TextFile.h"
+
+//------------------------------------------------------------------------------------------------------
+// Function: CAllPlayersStats::init
+// Purpose: intializes the object
+//------------------------------------------------------------------------------------------------------
+void CAllPlayersStats::init()
+{
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CAllPlayersStats::generate
+// Purpose: generates intermediate data from match info
+//------------------------------------------------------------------------------------------------------
+void CAllPlayersStats::generate()
+{
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CAllPlayersStats::writeHTML
+// Purpose: writes out html based on the intermediate data generated by generate()
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CAllPlayersStats::writeHTML(CHTMLFile& html)
+{
+ string filename;
+ bool result=g_pApp->os->findfirstfile("*.tfs",filename);
+
+ if (!result)
+ return;
+
+ multimap<double,CPlrPersist,greater<double> > ranksort;
+
+ html.write("<table cols=1 cellspacing=0 border=0 cellpadding=10 bordercolor=black>\n");
+ while(1)
+ {
+ CTextFile f(filename);
+ pair<double,CPlrPersist> insertme;
+ insertme.second.read(f);
+ insertme.first=insertme.second.rank();
+
+ ranksort.insert(insertme);
+
+ if (!g_pApp->os->findnextfile(filename))
+ break;
+
+
+ }
+
+ g_pApp->os->findfileclose();
+
+ multimap<double,CPlrPersist,greater<double> >::iterator rankit=ranksort.begin();
+
+ for (rankit;rankit!=ranksort.end();++rankit)
+ {
+ bool rowstarted=false;
+ //double rank=rankit->first;
+ CPlrPersist* pcpp=&(rankit->second);
+
+ time_t cutoff=g_pMatchInfo->logOpenTime() - g_pApp->getCutoffSeconds();
+
+ if (pcpp->lastplayed >= cutoff || !g_pApp->eliminateOldPlayers)
+ {
+ if (!rowstarted)
+ {
+ rowstarted=true;
+ html.write("<tr>\n");
+ }
+
+ html.write("<td width=300 valign=top>");
+ CPlayerReport pr(pcpp);
+ pr.writeHTML(html);
+ html.write("</td>\n");
+ }
+ if (++rankit==ranksort.end())
+ {
+ if (rowstarted)
+ html.write("</tr>\n");
+ break;
+ }
+
+
+ //double rank=rankit->first;
+ CPlrPersist* pcpp2=&(rankit->second);
+ if (pcpp->lastplayed >= cutoff || !g_pApp->eliminateOldPlayers)
+ {
+ if (!rowstarted)
+ {
+ rowstarted=true;
+ html.write("<tr>\n");
+ }
+
+ html.write("<td width=300 valign=top>");
+ CPlayerReport pr2(pcpp2);
+ pr2.writeHTML(html);
+ html.write("</td>\n");
+ }
+ if (rowstarted)
+ html.write("</tr>\n");
+ }
+
+ html.write("</table>");
+
+}
+