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.

66 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Implementation of CCureAward
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "CureAward.h"
  14. //------------------------------------------------------------------------------------------------------
  15. // Function: CCureAward::getWinner
  16. // Purpose: determines who cured the most people during the match
  17. //------------------------------------------------------------------------------------------------------
  18. void CCureAward::getWinner()
  19. {
  20. CEventListIterator it;
  21. for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
  22. {
  23. if ((*it)->getType()==CLogEvent::CURE)
  24. {
  25. PID doc=(*it)->getArgument(0)->asPlayerGetPID();
  26. numcures[doc]++;
  27. winnerID=doc;
  28. fNoWinner=false;
  29. }
  30. }
  31. map<PID,int>::iterator cureiter;
  32. for (cureiter=numcures.begin();cureiter!=numcures.end();++cureiter)
  33. {
  34. PID currID=(*cureiter).first;
  35. if (numcures[currID]>numcures[winnerID])
  36. winnerID=currID;
  37. }
  38. }
  39. //------------------------------------------------------------------------------------------------------
  40. // Function: CCureAward::noWinner
  41. // Purpose: writes html indicating that no one was cured during this match
  42. // Input: html - the html file to write to
  43. //------------------------------------------------------------------------------------------------------
  44. void CCureAward::noWinner(CHTMLFile& html)
  45. {
  46. html.write("No one was cured during this match.");
  47. }
  48. //------------------------------------------------------------------------------------------------------
  49. // Function: CCureAward::extendedinfo
  50. // Purpose: reports how many people the winner cured
  51. // Input: html - the html file to write to
  52. //------------------------------------------------------------------------------------------------------
  53. void CCureAward::extendedinfo(CHTMLFile& html)
  54. {
  55. if (numcures[winnerID]==1)
  56. html.write("%s cured 1 sick person!",winnerName.c_str());
  57. else
  58. html.write("%s healed cured %li sick people!",winnerName.c_str(),numcures[winnerID]);
  59. }