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.

91 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #pragma warning (disable:4786)
  9. //=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
  10. //
  11. // The copyright to the contents herein is the property of Valve, L.L.C.
  12. // The contents may be used and/or copied only with the written permission of
  13. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  14. // the agreement/contract under which the contents have been supplied.
  15. //
  16. // Purpose:
  17. //
  18. // $Workfile: $
  19. // $Date: $
  20. //
  21. //------------------------------------------------------------------------------------------------------
  22. // $Log: $
  23. //
  24. // $NoKeywords: $
  25. //=============================================================================
  26. #ifndef PLRPERSIST_H
  27. #define PLRPERSIST_H
  28. #ifdef WIN32
  29. #pragma once
  30. #endif
  31. #include <time.h>
  32. #include <map>
  33. #include <string>
  34. #include <list>
  35. #include <utility>
  36. #include "TimeIndexedList.h"
  37. #include "Player.h"
  38. #include "TextFile.h"
  39. using namespace std;
  40. //------------------------------------------------------------------------------------------------------
  41. // Purpose: Represents persistent player data. This class is used to save and load
  42. // Player data from the disk.
  43. //------------------------------------------------------------------------------------------------------
  44. class CPlrPersist
  45. {
  46. public:
  47. unsigned long WONID;
  48. int kills;
  49. int deaths;
  50. time_t timeon;
  51. bool valid;
  52. string faveString(map<string,int>& theMap);
  53. map<string,int> nickmap;
  54. string faveName();
  55. map<string,int> weapmap;
  56. string faveWeap();
  57. map<string,int> classmap;
  58. string faveClass();
  59. list<pair<time_t,time_t> > playtimes;
  60. time_t lastplayed;
  61. int matches;
  62. int suicides;
  63. int faveweapkills;
  64. double rank();
  65. CPlrPersist()
  66. {
  67. kills=deaths=suicides=faveweapkills=matches=0;WONID=-1;
  68. }
  69. void read(unsigned long WONID);
  70. void read(CTextFile& f);
  71. void merge(CPlrPersist& cpp,bool mergeOverlaps=false);
  72. void generate(CPlayer& cp);
  73. void write();
  74. list<pair<time_t,time_t> >::iterator timesOverlap(time_t start, time_t end,bool testself=true);
  75. };
  76. #endif // PLRPERSIST_H