summaryrefslogtreecommitdiff
path: root/utils/tfstats/sentryrebuildaward.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/sentryrebuildaward.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/tfstats/sentryrebuildaward.cpp')
-rw-r--r--utils/tfstats/sentryrebuildaward.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/utils/tfstats/sentryrebuildaward.cpp b/utils/tfstats/sentryrebuildaward.cpp
new file mode 100644
index 0000000..8881ff3
--- /dev/null
+++ b/utils/tfstats/sentryrebuildaward.cpp
@@ -0,0 +1,72 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Implementation of CSentryRebuildAward
+//
+// $Workfile: $
+// $Date: $
+//
+//------------------------------------------------------------------------------------------------------
+// $Log: $
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "SentryRebuildAward.h"
+
+//------------------------------------------------------------------------------------------------------
+// Function: CSentryRebuildAward::getWinner
+// Purpose: scans to find whose sentry guns were built the most often
+//------------------------------------------------------------------------------------------------------
+void CSentryRebuildAward::getWinner()
+{
+ CEventListIterator it;
+
+ for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
+ {
+ if ((*it)->getType()==CLogEvent::BUILD)
+ {
+ string built=(*it)->getArgument(1)->getStringValue();
+
+ if (stricmp(built.c_str(),"sentry") == 0)
+ {
+ PID builder=(*it)->getArgument(0)->asPlayerGetPID();
+ numbuilds[builder]++;
+ winnerID=builder;
+ fNoWinner=false;
+ }
+ }
+ }
+
+ map<PID,int>::iterator builditer;
+
+ for (builditer=numbuilds.begin();builditer!=numbuilds.end();++builditer)
+ {
+ int currID=(*builditer).first;
+ if (numbuilds[currID]>numbuilds[winnerID])
+ winnerID=currID;
+ }
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CSentryRebuildAward::noWinner
+// Purpose: writes html indicating that no one built any sentries
+// Input: html - the html file to write to
+//------------------------------------------------------------------------------------------------------
+void CSentryRebuildAward::noWinner(CHTMLFile& html)
+{
+ html.write("No sentries were built during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CSentryRebuildAward::extendedinfo
+// Purpose: reports how many times the winner had to rebuild their sentry
+// Input: html - the html file to write to
+//------------------------------------------------------------------------------------------------------
+void CSentryRebuildAward::extendedinfo(CHTMLFile& html)
+{
+
+ if (numbuilds[winnerID] == 1)
+ html.write("No one had to rebuild a sentry gun in this match.!",winnerName.c_str());
+ else
+ html.write("%s had to build a sentry gun %li times!",winnerName.c_str(),numbuilds[winnerID]);
+}
+