blob: 5edde84747fdeccf8016610394f97f82d6305bcb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Implementation of CPlayerSpecifics
//
// $Workfile: $
// $Date: $
//
//------------------------------------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include "PlayerSpecifics.h"
#include "PlayerReport.h"
//------------------------------------------------------------------------------------------------------
// Function: CPlayerSpecifics::init
// Purpose: intializes the object
//------------------------------------------------------------------------------------------------------
void CPlayerSpecifics::init()
{
}
//------------------------------------------------------------------------------------------------------
// Function: CPlayerSpecifics::generate
// Purpose: generates intermediate data from match info
//------------------------------------------------------------------------------------------------------
void CPlayerSpecifics::generate()
{
}
//------------------------------------------------------------------------------------------------------
// Function: CPlayerSpecifics::writeHTML
// Purpose: writes out html based on the intermediate data generated by generate()
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CPlayerSpecifics::writeHTML(CHTMLFile& html)
{
int numteams=0;
for (int t=0;t<MAX_TEAMS;t++)
if (g_pMatchInfo->teamExists(t)) numteams++;
html.write("<table cols=%li cellspacing=0 border=0 cellpadding=10 bordercolor=black>\n",numteams);
CPlayerListIterator i;
//multimap<double,CPlayer,greater<double> > ranksort;
//split playerlist into teams;
multimap<double,CPlayer,greater<double> > rankedteams[MAX_TEAMS];
for (i=g_pMatchInfo->playerBegin();i!=g_pMatchInfo->playerEnd();++i)
{
PID pid=(*i).first;
CPlayer p=(*i).second;
for (int t=0;t<MAX_TEAMS;t++)
{
if (p.teams.contains(t))
{
double rank=p.perteam[t].rank();
pair<double,CPlayer> insertme(rank,p);
rankedteams[t].insert(insertme);
}
}
}
while(!rankedteams[0].empty() || !rankedteams[1].empty() || !rankedteams[2].empty() || !rankedteams[3].empty())
{
html.write("<tr>\n");
int t;
for (t=0;t<MAX_TEAMS;t++)
{
if (!g_pMatchInfo->teamExists(t))
continue;
html.write("<td width=250 valign=top>");
if (rankedteams[t].begin()==rankedteams[t].end())
continue;
else
{
CPlayer& plr=(*(rankedteams[t].begin())).second;
CPlayerReport cpr(&plr,t);
cpr.writeHTML(html);
rankedteams[t].erase(rankedteams[t].begin());
//break;
}
html.write("</td>\n");
}
html.write("</tr>\n");
}
html.write("</table>");
}
|