summaryrefslogtreecommitdiff
path: root/utils/tfstats/player.h
blob: d4ffcc26e95336ba68a8dd92375b1106d933d502 (plain) (blame)
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
92
93
94
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Interface of CPlayer
//
// $Workfile:     $
// $Date:         $
//
//------------------------------------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#pragma warning (disable:4786)
#ifndef PLAYER_H
#define PLAYER_H
#ifdef WIN32
#pragma once
#endif

#include <time.h>
#include <map>
#include <string>

#include "util.h"

#include "TimeIndexedList.h"
#include "pid.h"
class CMatchInfo;

class CPlayer
{
public:
	struct plr_per_team_data
	{
		int kills;
		int deaths;
		int suicides;
		//double rank;
		int teamkills;
		int teamkilled;
		std::map<std::string,int> weaponKills;
		std::string faveweapon;
		int faveweapkills;
		double rank();
		std::string faveWeapon();
		int faveWeapKills();
		plr_per_team_data(){kills=deaths=suicides=teamkills=teamkilled=faveweapkills=0;}
		
		CTimeIndexedList<player_class> classesplayed; //stores class, indexed by the time when that class was switched to.
		
		time_t timeon;
		time_t timeOn();
	};
	
	CTimeIndexedList<player_class> allclassesplayed; //stores class, indexed by the time when that class was switched to.
	
	CTimeIndexedList<int> teams;
	plr_per_team_data perteam[MAX_TEAMS+1];
	
	CTimeIndexedList<std::string> aliases; 
	std::string name; //this will be set to the favourite name of the player
	//int team;
	int svrPID;
	unsigned long WONID;
	string ipAddress;
	int reconnects;
	
	
	PID pid;
	time_t logontime;
	time_t logofftime;
	time_t totalTimeOn();



	
//	int teamID(){return team;}
	CPlayer();

	void nameFound(time_t t, std::string alias);	



	

	//merge stats from all teams into 5th "team" (all teams)
	void merge();
};

#include "pid.h"
typedef std::map<PID,CPlayer> CPlayerList;
typedef CPlayerList::iterator CPlayerListIterator;

#endif // PLAYER_H