//========= 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 > ranksort; html.write("\n"); while(1) { CTextFile f(filename); pair 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 >::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("\n"); } html.write("\n"); } if (++rankit==ranksort.end()) { if (rowstarted) html.write("\n"); break; } //double rank=rankit->first; CPlrPersist* pcpp2=&(rankit->second); if (pcpp->lastplayed >= cutoff || !g_pApp->eliminateOldPlayers) { if (!rowstarted) { rowstarted=true; html.write("\n"); } html.write("\n"); } if (rowstarted) html.write("\n"); } html.write("
"); CPlayerReport pr(pcpp); pr.writeHTML(html); html.write("
"); CPlayerReport pr2(pcpp2); pr2.writeHTML(html); html.write("
"); }