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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Implementation of the Weapon Awards
//
// $Workfile: $
// $Date: $
//
//------------------------------------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include "WeaponAwards.h"
//------------------------------------------------------------------------------------------------------
// Function: CWeaponAward::getWinner
// Purpose: all weapon awards use this to generate their winners
//------------------------------------------------------------------------------------------------------
void CWeaponAward::getWinner()
{
CEventListIterator it;
for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
{
if ((*it)->getType()==CLogEvent::FRAG)
{
if (strcmp((*it)->getArgument(2)->getStringValue(),killtype)==0)
{
PID pid=(*it)->getArgument(0)->asPlayerGetPID();
accum[pid]++;
winnerID=pid;
fNoWinner=false;
}
}
}
map<PID,int>::iterator acc_it;
for (acc_it=accum.begin();acc_it!=accum.end();++acc_it)
{
int currID=(*acc_it).first;
if (accum[currID]>accum[winnerID])
winnerID=currID;
}
}
//------------------------------------------------------------------------------------------------------
// Function: CAssaultCannonAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CAssaultCannonAward::noWinner(CHTMLFile& html)
{
html.write("No one was killed with the Assault Cannon during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CAssaultCannonAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CAssaultCannonAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s got 1 kill with the Assault Cannon!",winnerName.c_str());
else
html.write("%s got %li kills with the Assault Cannon!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CFlamethrowerAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CFlamethrowerAward::noWinner(CHTMLFile& html)
{
html.write("No one got torched during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CFlamethrowerAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CFlamethrowerAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s torched 1 person!",winnerName.c_str());
else
html.write("%s torched %li people!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CKnifeAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CKnifeAward::noWinner(CHTMLFile& html)
{
html.write("No one got knifed during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CKnifeAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CKnifeAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s backstabbed 1 person!",winnerName.c_str());
else
html.write("%s backstabbed %li people!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CRocketryAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CRocketryAward::noWinner(CHTMLFile& html)
{
html.write("No one was killed by a rocket during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CRocketryAward::extendedinfo
// Purpose:
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CRocketryAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s rocketed 1 person to oblivion!",winnerName.c_str());
else
html.write("%s rocketed %li people to oblivion!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CGrenadierAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CGrenadierAward::noWinner(CHTMLFile& html)
{
html.write("No one was killed by a grenade during this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CGrenadierAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CGrenadierAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s killed 1 person with a grenade!",winnerName.c_str());
else
html.write("%s got %li people with grenades!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CDemolitionsAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CDemolitionsAward::noWinner(CHTMLFile& html)
{
html.write("No one fell victim to a Detpack this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CDemolitionsAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CDemolitionsAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s smeared 1 person with a detpack!",winnerName.c_str());
else
html.write("%s smeared %li people with detpacks!",winnerName.c_str(),accum[winnerID]);
}
//------------------------------------------------------------------------------------------------------
// Function: CBiologicalWarfareAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CBiologicalWarfareAward::noWinner(CHTMLFile& html)
{
html.write("No one died of infection this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CBiologicalWarfareAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CBiologicalWarfareAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s infected 1 person.",winnerName.c_str());
else
html.write("%li people succumbed to %s's disease.",accum[winnerID],winnerName.c_str());
}
//------------------------------------------------------------------------------------------------------
// Function: CBestSentryAward::noWinner
// Purpose: writes out html indicating that no one won this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CBestSentryAward::noWinner(CHTMLFile& html)
{
html.write("No sentries killed anyone this match.");
}
//------------------------------------------------------------------------------------------------------
// Function: CBestSentryAward::extendedinfo
// Purpose: writes out html displaying extra information about the winning of this award
// Input: html - the html file to output to
//------------------------------------------------------------------------------------------------------
void CBestSentryAward::extendedinfo(CHTMLFile& html)
{
if (accum[winnerID]==1)
html.write("%s got 1 person with a sentry gun!",winnerName.c_str());
else
html.write("%li people were killed by %s's well placed sentries.",accum[winnerID],winnerName.c_str());
}
|