blob: a867a035d5eb282cdada354861d6a5ca449e9534 (
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Implementation of CCureAward
//
// $Workfile: $
// $Date: $
//
//------------------------------------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include "CureAward.h"
//------------------------------------------------------------------------------------------------------
// Function: CCureAward::getWinner
// Purpose: determines who cured the most people during the match
//------------------------------------------------------------------------------------------------------
void CCureAward::getWinner()
{
CEventListIterator it;
for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
{
if ((*it)->getType()==CLogEvent::CURE)
{
PID doc=(*it)->getArgument(0)->asPlayerGetPID();
numcures[doc]++;
winnerID=doc;
fNoWinner=false;
}
}
map<PID,int>::iterator cureiter;
for (cureiter=numcures.begin();cureiter!=numcures.end();++cureiter)
{
PID currID=(*cureiter).first;
if (numcures[currID]>numcures[winnerID])
winnerID=currID;
}
}
//------------------------------------------------------------------------------------------------------
// Function: CCureAward::noWinner
// Purpose: writes html indicating that no one was cured during this match
// Input: html - the html file to write to
//------------------------------------------------------------------------------------------------------
void CCureAward::noWinner(CHTMLFile& html)
{
html.write("No one was cured during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CCureAward::extendedinfo
// Purpose: reports how many people the winner cured
// Input: html - the html file to write to
//------------------------------------------------------------------------------------------------------
void CCureAward::extendedinfo(CHTMLFile& html)
{
if (numcures[winnerID]==1)
html.write("%s cured 1 sick person!",winnerName.c_str());
else
html.write("%s healed cured %li sick people!",winnerName.c_str(),numcures[winnerID]);
}
|