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.

59 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Implementation of CAward
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "Award.h"
  14. //------------------------------------------------------------------------------------------------------
  15. // Function: CAward::CAward
  16. // Purpose: Constructor.
  17. // Input: name - the name of the award
  18. // pmi - a pointer to the match information
  19. //------------------------------------------------------------------------------------------------------
  20. CAward::CAward(char* name)
  21. :awardName(name),fNoWinner(true),winnerID(-1)
  22. {}
  23. //------------------------------------------------------------------------------------------------------
  24. // Function: CAward::generate
  25. // Purpose: overrides generate to call the more-semantically correct getWinner()
  26. // when dealing with subclasses of awards. Also after getWinner has determined
  27. // which PID is the winner, this assigns the correct name to the winnerName field
  28. //------------------------------------------------------------------------------------------------------
  29. void CAward::generate()
  30. {
  31. winnerName="";
  32. getWinner();
  33. if (winnerID!=-1)
  34. winnerName=g_pMatchInfo->playerName(winnerID);
  35. }
  36. //------------------------------------------------------------------------------------------------------
  37. // Function: CAward::writeHTML
  38. // Purpose: writes the award to the given html page
  39. // Input: html - the page to output the award to
  40. //------------------------------------------------------------------------------------------------------
  41. void CAward::writeHTML(CHTMLFile& html)
  42. {
  43. if (fNoWinner || (winnerID == -1 && winnerName==""))
  44. noWinner(html);
  45. else
  46. {
  47. html.write("The <font class=brightawards>%s</font> award goes to %s! ",awardName.c_str(),winnerName.c_str());
  48. extendedinfo(html);
  49. }
  50. html.br();
  51. html.write("\n");
  52. }
  53. CAward::~CAward()
  54. {
  55. }