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/kamikazeaward.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/tfstats/kamikazeaward.cpp')
| -rw-r--r-- | utils/tfstats/kamikazeaward.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/utils/tfstats/kamikazeaward.cpp b/utils/tfstats/kamikazeaward.cpp new file mode 100644 index 0000000..aafd336 --- /dev/null +++ b/utils/tfstats/kamikazeaward.cpp @@ -0,0 +1,66 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implementation of CKamikazeAward +// +// $Workfile: $ +// $Date: $ +// +//------------------------------------------------------------------------------------------------------ +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include "KamikazeAward.h" + +//------------------------------------------------------------------------------------------------------ +// Function: CKamikazeAward::getWinner +// Purpose: determines the winner of the award +//------------------------------------------------------------------------------------------------------ +void CKamikazeAward::getWinner() +{ + CEventListIterator it; + + for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it) + { + if ((*it)->getType()==CLogEvent::SUICIDE || (*it)->getType()==CLogEvent::KILLED_BY_WORLD) + { + PID kami=(*it)->getArgument(0)->asPlayerGetPID(); + numdeaths[kami]++; + winnerID=kami; + fNoWinner=false; + } + } + + map<PID,int>::iterator kamiter; + + for (kamiter=numdeaths.begin();kamiter!=numdeaths.end();++kamiter) + { + int currID=(*kamiter).first; + if (numdeaths[currID]>numdeaths[winnerID]) + winnerID=currID; + } +} + +//------------------------------------------------------------------------------------------------------ +// Function: CKamikazeAward::noWinner +// Purpose: writes html indicating that no one won this award +// Input: html - the html file to write to +//------------------------------------------------------------------------------------------------------ +void CKamikazeAward::noWinner(CHTMLFile& html) +{ + html.write("No one killed themselves during this match! Good work!"); +} + +//------------------------------------------------------------------------------------------------------ +// Function: CKamikazeAward::extendedinfo +// Purpose: reports how many times the winner killed him/herself +// Input: html - the html file to write to +//------------------------------------------------------------------------------------------------------ +void CKamikazeAward::extendedinfo(CHTMLFile& html) +{ + if (numdeaths[winnerID]==1) + html.write("%s suicided once.",winnerName.c_str()); + else + html.write("%s was self-victimized %li times.",winnerName.c_str(),numdeaths[winnerID]); +} + |