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.

94 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface of CPlayer
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #pragma warning (disable:4786)
  14. #ifndef PLAYER_H
  15. #define PLAYER_H
  16. #ifdef WIN32
  17. #pragma once
  18. #endif
  19. #include <time.h>
  20. #include <map>
  21. #include <string>
  22. #include "util.h"
  23. #include "TimeIndexedList.h"
  24. #include "pid.h"
  25. class CMatchInfo;
  26. class CPlayer
  27. {
  28. public:
  29. struct plr_per_team_data
  30. {
  31. int kills;
  32. int deaths;
  33. int suicides;
  34. //double rank;
  35. int teamkills;
  36. int teamkilled;
  37. std::map<std::string,int> weaponKills;
  38. std::string faveweapon;
  39. int faveweapkills;
  40. double rank();
  41. std::string faveWeapon();
  42. int faveWeapKills();
  43. plr_per_team_data(){kills=deaths=suicides=teamkills=teamkilled=faveweapkills=0;}
  44. CTimeIndexedList<player_class> classesplayed; //stores class, indexed by the time when that class was switched to.
  45. time_t timeon;
  46. time_t timeOn();
  47. };
  48. CTimeIndexedList<player_class> allclassesplayed; //stores class, indexed by the time when that class was switched to.
  49. CTimeIndexedList<int> teams;
  50. plr_per_team_data perteam[MAX_TEAMS+1];
  51. CTimeIndexedList<std::string> aliases;
  52. std::string name; //this will be set to the favourite name of the player
  53. //int team;
  54. int svrPID;
  55. unsigned long WONID;
  56. string ipAddress;
  57. int reconnects;
  58. PID pid;
  59. time_t logontime;
  60. time_t logofftime;
  61. time_t totalTimeOn();
  62. // int teamID(){return team;}
  63. CPlayer();
  64. void nameFound(time_t t, std::string alias);
  65. //merge stats from all teams into 5th "team" (all teams)
  66. void merge();
  67. };
  68. #include "pid.h"
  69. typedef std::map<PID,CPlayer> CPlayerList;
  70. typedef CPlayerList::iterator CPlayerListIterator;
  71. #endif // PLAYER_H