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