Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Implemenation of CTeamKillAward
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "TeamKillAward.h"
  14. //------------------------------------------------------------------------------------------------------
  15. // Function: CTeamKillAward::getWinner
  16. // Purpose: generates the winner of the award
  17. //------------------------------------------------------------------------------------------------------
  18. void CTeamKillAward::getWinner()
  19. {
  20. CEventListIterator it;
  21. for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
  22. {
  23. if ((*it)->getType()==CLogEvent::TEAM_FRAG)
  24. {
  25. PID traitor=(*it)->getArgument(0)->asPlayerGetPID();
  26. numbetrayals[traitor]++;
  27. winnerID=traitor;
  28. fNoWinner=false;
  29. }
  30. }
  31. map<PID,int>::iterator traitoriter;
  32. for (traitoriter=numbetrayals.begin();traitoriter!=numbetrayals.end();++traitoriter)
  33. {
  34. int currID=(*traitoriter).first;
  35. if (numbetrayals[currID]>numbetrayals[winnerID])
  36. winnerID=currID;
  37. }
  38. }
  39. //------------------------------------------------------------------------------------------------------
  40. // Function: CTeamKillAward::noWinner
  41. // Purpose: writes html to indicate that there was no winner of this award
  42. // Input: html - the html file to write to
  43. //------------------------------------------------------------------------------------------------------
  44. void CTeamKillAward::noWinner(CHTMLFile& html)
  45. {
  46. html.write("No one killed any teammates! Good Work!");
  47. }
  48. //------------------------------------------------------------------------------------------------------
  49. // Function: CTeamKillAward::extendedinfo
  50. // Purpose: writes out how many teammates were killed by the traitor
  51. // Input: html - the html file to write to
  52. //------------------------------------------------------------------------------------------------------
  53. void CTeamKillAward::extendedinfo(CHTMLFile& html)
  54. {
  55. html.write("The traitor %s murdered %li teammates.",winnerName.c_str(),numbetrayals[winnerID]);
  56. }