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/teamkillaward.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/tfstats/teamkillaward.cpp')
| -rw-r--r-- | utils/tfstats/teamkillaward.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/utils/tfstats/teamkillaward.cpp b/utils/tfstats/teamkillaward.cpp new file mode 100644 index 0000000..dbf2333 --- /dev/null +++ b/utils/tfstats/teamkillaward.cpp @@ -0,0 +1,62 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implemenation of CTeamKillAward +// +// $Workfile: $ +// $Date: $ +// +//------------------------------------------------------------------------------------------------------ +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include "TeamKillAward.h" + +//------------------------------------------------------------------------------------------------------ +// Function: CTeamKillAward::getWinner +// Purpose: generates the winner of the award +//------------------------------------------------------------------------------------------------------ +void CTeamKillAward::getWinner() +{ + CEventListIterator it; + + for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it) + { + if ((*it)->getType()==CLogEvent::TEAM_FRAG) + { + PID traitor=(*it)->getArgument(0)->asPlayerGetPID(); + numbetrayals[traitor]++; + winnerID=traitor; + fNoWinner=false; + } + } + + map<PID,int>::iterator traitoriter; + + for (traitoriter=numbetrayals.begin();traitoriter!=numbetrayals.end();++traitoriter) + { + int currID=(*traitoriter).first; + if (numbetrayals[currID]>numbetrayals[winnerID]) + winnerID=currID; + } +} + +//------------------------------------------------------------------------------------------------------ +// Function: CTeamKillAward::noWinner +// Purpose: writes html to indicate that there was no winner of this award +// Input: html - the html file to write to +//------------------------------------------------------------------------------------------------------ +void CTeamKillAward::noWinner(CHTMLFile& html) +{ + html.write("No one killed any teammates! Good Work!"); +} + +//------------------------------------------------------------------------------------------------------ +// Function: CTeamKillAward::extendedinfo +// Purpose: writes out how many teammates were killed by the traitor +// Input: html - the html file to write to +//------------------------------------------------------------------------------------------------------ +void CTeamKillAward::extendedinfo(CHTMLFile& html) +{ + html.write("The traitor %s murdered %li teammates.",winnerName.c_str(),numbetrayals[winnerID]); +} |