diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/cureaward.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/tfstats/cureaward.cpp')
| -rw-r--r-- | utils/tfstats/cureaward.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/utils/tfstats/cureaward.cpp b/utils/tfstats/cureaward.cpp new file mode 100644 index 0000000..a867a03 --- /dev/null +++ b/utils/tfstats/cureaward.cpp @@ -0,0 +1,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]); +} + |