//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: Implementation of CScoreboard // // $Workfile: $ // $Date: $ // //------------------------------------------------------------------------------------------------------ // $Log: $ // // $NoKeywords: $ //=============================================================================// #include "Scoreboard.h" //------------------------------------------------------------------------------------------------------ // Function: CScoreboard::init // Purpose: initializes the object //------------------------------------------------------------------------------------------------------ void CScoreboard::init() { } //------------------------------------------------------------------------------------------------------ // Function: CScoreboard::generate // Purpose: generates intermediate data based on match info //------------------------------------------------------------------------------------------------------ void CScoreboard::generate() { } //------------------------------------------------------------------------------------------------------ // Function: CScoreboard::writeHTML // Purpose: generates html from the intermediate data generated by generate() // Input: html - the html file to write the html code into //------------------------------------------------------------------------------------------------------ void CScoreboard::writeHTML(CHTMLFile& html) { CPlayerListIterator i; int t; bool teamFound=false; for (t=0;tteamExists(t)) continue; if (!teamFound) { html.write("

"); html.write("",g_pApp->supportHTTPPath.c_str()); teamFound=true; } int totalkills=0; int totaldeaths=0; double teamrank=0; int numplrs=0; html.write(""); html.write(""); html.write("",g_pMatchInfo->teamName(t).c_str()); html.write(""); html.write(""); html.write(""); html.write(""); multimap ranksort; for (i=g_pMatchInfo->playerBegin();i!=g_pMatchInfo->playerEnd();++i) { pair plr=(*i); PID pid=plr.first; CPlayer& p=plr.second; if (p.teams.contains(t)) { double rank=p.perteam[t].rank(); pair insertme(rank,p); ranksort.insert(insertme); //ranksort[rank]=p; } } multimap::reverse_iterator i2; for (i2=ranksort.rbegin();i2!=ranksort.rend();++i2) { double rank=(*i2).first; CPlayer p=(*i2).second; if (!p.teams.contains(t)) { continue; } html.write("\n"); html.write("\n"); html.write("\n",Util::teamcolormap[t],p.name.c_str()); html.write("\n",p.perteam[t].kills); html.write("\n",p.perteam[t].deaths); html.write("\n",rank); html.write("\n"); totalkills+=p.perteam[t].kills; totaldeaths+=p.perteam[t].deaths; teamrank+=rank; numplrs++; } html.write(""); html.write(""); html.write(""); html.write(""); html.write(""); html.write("",totalkills); html.write("",totaldeaths); html.write("",teamrank/numplrs); html.write(""); html.write("
%sKillsDeathsRank
%s%li%li%.2lf

totals%li%li%.2lf (avg)
\n

\n"); } }