summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_gamestats_shared.h
blob: 52c5f9900f5ed59db6d2ef61df0617559e4d01b8 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================
#ifndef TF_GAMESTATS_SHARED_H
#define TF_GAMESTATS_SHARED_H
#ifdef _WIN32
#pragma once
#endif
#include "cbase.h"
#include "tier1/utlvector.h"
#include "tier1/utldict.h"
#include "shareddefs.h"
#include "tf_shareddefs.h"

//=============================================================================
//
// TF Game Stats Enums
//
// NOTE: You may add to the end, but do not insert to this list!
//
enum TFStatType_t
{
	TFSTAT_UNDEFINED = 0,
	TFSTAT_SHOTS_HIT,
	TFSTAT_SHOTS_FIRED,
	TFSTAT_KILLS,
	TFSTAT_DEATHS,
	TFSTAT_DAMAGE,
	TFSTAT_CAPTURES,
	TFSTAT_DEFENSES,
	TFSTAT_DOMINATIONS,
	TFSTAT_REVENGE,
	TFSTAT_POINTSSCORED,
	TFSTAT_BUILDINGSDESTROYED,
	TFSTAT_HEADSHOTS,
	TFSTAT_PLAYTIME,
	TFSTAT_HEALING,
	TFSTAT_INVULNS,
	TFSTAT_KILLASSISTS,
	TFSTAT_BACKSTABS,
	TFSTAT_HEALTHLEACHED,
	TFSTAT_BUILDINGSBUILT,
	TFSTAT_MAXSENTRYKILLS,
	TFSTAT_TELEPORTS,
	TFSTAT_FIREDAMAGE,
	TFSTAT_BONUS_POINTS,
	TFSTAT_BLASTDAMAGE,
	TFSTAT_DAMAGETAKEN,
	TFSTAT_HEALTHKITS,
	TFSTAT_AMMOKITS,
	TFSTAT_CLASSCHANGES,
	TFSTAT_CRITS,
	TFSTAT_SUICIDES,
	TFSTAT_CURRENCY_COLLECTED,
	TFSTAT_DAMAGE_ASSIST,
	TFSTAT_HEALING_ASSIST,
	TFSTAT_DAMAGE_BOSS,
	TFSTAT_DAMAGE_BLOCKED,
	TFSTAT_DAMAGE_RANGED,
	TFSTAT_DAMAGE_RANGED_CRIT_RANDOM,
	TFSTAT_DAMAGE_RANGED_CRIT_BOOSTED,
	TFSTAT_REVIVED,
	TFSTAT_THROWABLEHIT,
	TFSTAT_THROWABLEKILL,
	TFSTAT_KILLSTREAK_MAX,
	TFSTAT_KILLS_RUNECARRIER,
	TFSTAT_FLAGRETURNS,
	TFSTAT_TOTAL
};

#define TFSTAT_FIRST (TFSTAT_UNDEFINED+1)
#define TFSTAT_LAST (TFSTAT_TOTAL-1)

extern const char *s_pStatStrings[ TFSTAT_TOTAL ];

enum TFMapStatType_t
{
	TFMAPSTAT_UNDEFINED = 0,
	TFMAPSTAT_PLAYTIME,
	TFMAPSTAT_TOTAL
};

#define TFMAPSTAT_FIRST (TFMAPSTAT_UNDEFINED+1)
#define TFMAPSTAT_LAST (TFMAPSTAT_TOTAL-1)

extern const char *s_pMapStatStrings[ TFMAPSTAT_TOTAL ];

enum TFRoundEndReason_t
{
	RE_ROUND_END,
	RE_CLIENT_DISCONNECT,
	RE_CLIENT_QUIT,
	RE_SERVER_MAP_CHANGE,
	RE_SERVER_SHUTDOWN,
	RE_TIME_LIMIT,
	RE_WIN_LIMIT,
	RE_WIN_DIFF_LIMIT,
	RE_ROUND_LIMIT,
	RE_NEXT_LEVEL_CVAR,
	MAX_ROUND_END_REASON
};

extern const char *g_aRoundEndReasons[MAX_ROUND_END_REASON];

//=============================================================================
//
// TF Player Round Stats
//
struct RoundStats_t
{
	int m_iStat[TFSTAT_TOTAL];

	RoundStats_t() { Reset(); };

	inline int Get( int i ) const
	{
		AssertMsg( i >= TFSTAT_UNDEFINED && i < TFSTAT_TOTAL, "Stat index out of range!" );
		return m_iStat[ i ];
	}

	inline void Set( int i, int nValue )
	{
		AssertMsg( i >= TFSTAT_UNDEFINED && i < TFSTAT_TOTAL, "Stat index out of range!" );
		m_iStat[ i ] = nValue;
	}

	void Reset()
	{
		for ( int i = 0; i < ARRAYSIZE( m_iStat ); i++ )
		{
			m_iStat[i] = 0;
		}
	};

	void AccumulateRound( const RoundStats_t &other )
	{
		for ( int i = 0; i < ARRAYSIZE( m_iStat ); i++ )
		{
			m_iStat[i] += other.m_iStat[i];
		}
	};
};

struct RoundMapStats_t
{
	int m_iStat[ TFMAPSTAT_TOTAL ];

	RoundMapStats_t() { Reset(); };

	inline int Get( int i ) const
	{
		AssertMsg( i >= TFMAPSTAT_UNDEFINED && i < TFMAPSTAT_TOTAL, "Map stat index out of range!" );
		return m_iStat[ i ];
	}

	inline void Set( int i, int nValue )
	{
		AssertMsg( i >= TFMAPSTAT_UNDEFINED && i < TFMAPSTAT_TOTAL, "Map stat index out of range!" );
		m_iStat[ i ] = nValue;
	}

	void Reset()
	{
		for ( int i = 0; i < ARRAYSIZE( m_iStat ); i++ )
		{
			m_iStat[i] = 0;
		}
	};

	void AccumulateRound( const RoundMapStats_t &other )
	{
		for ( int i = 0; i < ARRAYSIZE( m_iStat ); i++ )
		{
			m_iStat[i] += other.m_iStat[i];
		}
	};
};

enum TFGameStatsVersions_t
{
	TF_GAMESTATS_FILE_VERSION = 006,
	TF_GAMESTATS_MAGIC = 0xDEADBEEF
};

enum TFGameStatsLumpIds_t
{
	TFSTATS_LUMP_VERSION = 1,
	TFSTATS_LUMP_MAPHEADER,
	TFSTATS_LUMP_MAPDEATH,
	TFSTATS_LUMP_MAPDAMAGE,
	TFSTATS_LUMP_CLASS,	
	TFSTATS_LUMP_WEAPON,
	TFSTATS_LUMP_ENDTAG,
	MAX_LUMP_COUNT
};

struct TF_Gamestats_Version_t
{
	int m_iMagic;			// always TF_GAMESTATS_MAGIC
	int m_iVersion;
};

struct TF_Gamestats_ClassStats_t
{
	static const unsigned short LumpId = TFSTATS_LUMP_CLASS;	// Lump ids.
	int iSpawns;												// total # of spawns of this class
	int iTotalTime;												// aggregate player time in seconds in this class
	int iScore;													// total # of points scored by this class
	int iKills;													// total # of kills by this class
	int iDeaths;												// total # of deaths by this class
	int iAssists;												// total # of assists by this class
	int iCaptures;												// total # of captures by this class
	int iClassChanges;											// total # of times someone changed to this class

	void Accumulate( TF_Gamestats_ClassStats_t &other )
	{
		iSpawns += other.iSpawns;
		iTotalTime += other.iTotalTime;
		iScore += other.iScore;
		iKills += other.iKills;
		iDeaths += other.iDeaths;
		iAssists += other.iAssists;
		iCaptures += other.iCaptures;
		iClassChanges += other.iClassChanges;
	}
};

struct TF_Gamestats_WeaponStats_t
{
	static const unsigned short LumpId = TFSTATS_LUMP_WEAPON;	// Lump ids.
	int iShotsFired;
	int iCritShotsFired;
	int	iHits;
	int iTotalDamage;
	int iHitsWithKnownDistance;
	int64 iTotalDistance;

	void Accumulate( TF_Gamestats_WeaponStats_t &other )
	{
		iShotsFired += other.iShotsFired;
		iCritShotsFired += other.iCritShotsFired;
		iHits += other.iHits;
		iTotalDamage += other.iTotalDamage;
		iHitsWithKnownDistance += other.iHitsWithKnownDistance;
		iTotalDistance += other.iTotalDistance;
	}
};

//=============================================================================
//
// TF Game Level Stats Data
//
struct TF_Gamestats_LevelStats_t
{
public:

	TF_Gamestats_LevelStats_t();
	~TF_Gamestats_LevelStats_t();
	TF_Gamestats_LevelStats_t( const TF_Gamestats_LevelStats_t &stats );

	// Level start and end
	void Init( const char *pszMapName, int nMapVersion, int nIPAddr, short nPort, float flStartTime );
	void Shutdown( float flEndTime );

	void Accumulate( TF_Gamestats_LevelStats_t *pOther )
	{
		m_Header.Accumulate( pOther->m_Header );
		//m_aPlayerDeaths.AddVectorToTail( pOther->m_aPlayerDeaths );
		//m_aPlayerDamage.AddVectorToTail( pOther->m_aPlayerDamage );
		int i;
		for ( i = 0; i < ARRAYSIZE( m_aClassStats ); i++ )
		{
			m_aClassStats[i].Accumulate( pOther->m_aClassStats[i] );
		}
		for ( i = 0; i < ARRAYSIZE( m_aWeaponStats ); i++ )
		{
			m_aWeaponStats[i].Accumulate( pOther->m_aWeaponStats[i] );
		}

	}
public:

	// Level header data.
	struct LevelHeader_t
	{
		static const unsigned short LumpId = TFSTATS_LUMP_MAPHEADER;	// Lump ids.
		char			m_szMapName[64];							// Name of the map.
		int				m_nMapRevision;								// Version number for the map.
		unsigned int	m_nIPAddr;									// IP Address of the server - 4 bytes stored as an int.
		unsigned short	m_nPort;									// Port the server is using.	
		int				m_iRoundsPlayed;							// # of rounds played
		int				m_iTotalTime;								// total # of seconds of all rounds
		int				m_iBlueWins;								// # of blue team wins
		int				m_iRedWins;									// # of red team wins
		int				m_iStalemates;								// # of stalemates
		int				m_iBlueSuddenDeathWins;						// # of blue team wins during sudden death
		int				m_iRedSuddenDeathWins;						// # of red team wins during sudden death
		int				m_iLastCapChangedInRound[MAX_CONTROL_POINTS+1];		// # of times a round ended on each control point

		void Accumulate( LevelHeader_t &other )
		{
			m_iRoundsPlayed += other.m_iRoundsPlayed;
			m_iTotalTime += other.m_iTotalTime;
			m_iBlueWins += other.m_iBlueWins;
			m_iRedWins += other.m_iRedWins;
			m_iStalemates += other.m_iStalemates;
			m_iBlueSuddenDeathWins += other.m_iBlueSuddenDeathWins;
			m_iRedSuddenDeathWins += other.m_iRedSuddenDeathWins;
			for ( int i = 0; i <= MAX_CONTROL_POINTS; i++ )
			{
				m_iLastCapChangedInRound[i] += other.m_iLastCapChangedInRound[i]; 
			}
		}
	};

	// Player deaths.
	struct PlayerDeathsLump_t
	{
		static const unsigned short LumpId = TFSTATS_LUMP_MAPDEATH;	// Lump ids.
		short			nPosition[3];								// Position of death.
		short			iWeapon;									// Weapon that killed the player.
		unsigned short	iDistance;									// Distance the attacker was from the player.
		byte			iAttackClass;								// Class that killed the player.
		byte			iTargetClass;								// Class of the player killed.
	};

	// Player damage.
	struct PlayerDamageLump_t
	{
		static const unsigned short LumpId = TFSTATS_LUMP_MAPDAMAGE;	// Lump ids.
		float			fTime;										// Time of the damage event
		short			nTargetPosition[3];							// Position of target.
		short			nAttackerPosition[3];						// Position of attacker.
		short			iDamage;									// Total damage.
		short			iWeapon;									// Weapon used.
		byte			iAttackClass;								// Class of the attacker
		byte			iTargetClass;								// Class of the target
		byte			iCrit;										// was the shot a crit?
		byte			iKill;										// did the shot kill the target?
	};

	// Data.
	LevelHeader_t					m_Header;							// Level header.
	// Disabling These Fields
	//CUtlVector<PlayerDeathsLump_t>	m_aPlayerDeaths;					// Vector of player deaths.
	//CUtlVector<PlayerDamageLump_t>	m_aPlayerDamage;					// Vector of player damage.	
	bool							m_bIsRealServer;
	TF_Gamestats_ClassStats_t		m_aClassStats[TF_CLASS_COUNT_ALL];	// Vector of class data
	TF_Gamestats_WeaponStats_t		m_aWeaponStats[TF_WEAPON_COUNT];	// Vector of weapon data
	// Temporary data.
	bool							m_bInitialized;		// Has the map Map Stat Data been initialized.
	time_t							m_iMapStartTime;
	time_t							m_iRoundStartTime; // time_t version for steamworks stats
	float							m_flRoundStartTime;
	int								m_iPeakPlayerCount[TF_TEAM_COUNT];
};

struct TF_Gamestats_RoundStats_t
{
public:

	TF_Gamestats_RoundStats_t();
	~TF_Gamestats_RoundStats_t();

private:
	TF_Gamestats_RoundStats_t( const TF_Gamestats_RoundStats_t &stats ) {}

public:
	void Reset();
	void ResetSummary();

	struct RoundSummary_t
	{
		int iTeamQuit;
		int iPoints;
		int iBonusPoints;
		int iKills;
		int iDeaths;
		int	iSuicides;
		int	iAssists;
		int	iBuildingsBuilt;
		int	iBuildingsDestroyed;
		int	iHeadshots;
		int	iDominations;
		int	iRevenges;
		int	iInvulns;
		int	iTeleports;
		int	iDamageDone;
		int	iHealingDone;
		int	iCrits;
		int	iBackstabs;
		int iThrowableHits;
		int iThrowableKills;
	};

	RoundSummary_t				m_Summary;

	static time_t				m_iRoundStartTime;
	static int					m_iNumRounds;
};

struct TF_Gamestats_KillStats_t
{
public:
	TF_Gamestats_KillStats_t();
	~TF_Gamestats_KillStats_t();

private:
	TF_Gamestats_KillStats_t( const TF_Gamestats_KillStats_t &stats ) {}

public:
	void Reset();
};

// Old style killstats matrix.
struct KillStats_t
{
	KillStats_t() { Reset(); }

	void Reset()
	{
		Q_memset( iNumKilled, 0, sizeof( iNumKilled ) );
		Q_memset( iNumKilledBy, 0, sizeof( iNumKilledBy ) );
		Q_memset( iNumKilledByUnanswered, 0, sizeof( iNumKilledByUnanswered ) );
	}

	int iNumKilled[MAX_PLAYERS+1];					// how many times this player has killed every other player
	int iNumKilledBy[MAX_PLAYERS+1];				// how many times this player has been killed by every other player
	int iNumKilledByUnanswered[MAX_PLAYERS+1];		// how many unanswered kills this player has been dealt by every other player
};

//=============================================================================
// LoadoutStats
struct LoadoutStats_t
{
	LoadoutStats_t() { Reset(); }

	void Reset()
	{
		V_memset( iLoadoutItemDefIndices, INVALID_ITEM_DEF_INDEX, sizeof( iLoadoutItemDefIndices ) );
		V_memset( iLoadoutItemQualities, AE_UNDEFINED, sizeof( iLoadoutItemQualities ) );
		V_memset( iLoadoutItemStyles, 0, sizeof( iLoadoutItemStyles ) );
		
		flStartTime = 0;
		iClass = TF_CLASS_UNDEFINED;
	}

	void Set ( int iPlayerClass )
	{
		iClass = iPlayerClass;
		flStartTime = gpGlobals->curtime;
	}

	void SetItemDef ( int iSlot, itemid_t iItemDef, entityquality_t iItemQuality, style_index_t iStyle )
	{
		iLoadoutItemDefIndices[iSlot] = iItemDef;
		iLoadoutItemQualities[iSlot] = iItemQuality;
		iLoadoutItemStyles[iSlot] = iStyle;
	}

	item_definition_index_t iLoadoutItemDefIndices[CLASS_LOADOUT_POSITION_COUNT];
	entityquality_t iLoadoutItemQualities[CLASS_LOADOUT_POSITION_COUNT];
	style_index_t iLoadoutItemStyles[CLASS_LOADOUT_POSITION_COUNT];
	float flStartTime;
	int iClass;
};

//=============================================================================
//
// TF Player Stats 
//
struct PlayerStats_t
{
	PlayerStats_t()	
	{
		Reset();
	};

	void Reset()
	{
		statsCurrentLife.Reset();
		statsCurrentRound.Reset();
		statsAccumulated.Reset();
		mapStatsCurrentLife.Reset();
		mapStatsCurrentRound.Reset();
		mapStatsAccumulated.Reset();
		statsKills.Reset();
		loadoutStats.Reset();
		iConnectTime = 0;
		iDisconnectTime = 0;
	}

	PlayerStats_t( const PlayerStats_t &other )
	{
		statsCurrentLife	= other.statsCurrentLife;
		statsCurrentRound	= other.statsCurrentRound;
		statsAccumulated	= other.statsAccumulated;
		mapStatsCurrentLife	= other.mapStatsCurrentLife;
		mapStatsCurrentRound = other.mapStatsCurrentRound;
		mapStatsAccumulated	= other.mapStatsAccumulated;
		loadoutStats		= other.loadoutStats;
		iConnectTime		= other.iConnectTime;
		iDisconnectTime		= other.iDisconnectTime;
	}

	RoundStats_t	statsCurrentLife;
	RoundStats_t	statsCurrentRound;
	RoundStats_t	statsAccumulated;
	RoundMapStats_t	mapStatsCurrentLife;
	RoundMapStats_t	mapStatsCurrentRound;
	RoundMapStats_t	mapStatsAccumulated;
	KillStats_t		statsKills;
	LoadoutStats_t	loadoutStats;
	int				iConnectTime;
	int				iDisconnectTime;
};

// reported stats structure that contains all stats data uploaded from TF server to Steam.  Note that this
// code is shared between TF server and processgamestats, which cracks the data file on the back end
struct TFReportedStats_t
{
	TFReportedStats_t();
	~TFReportedStats_t();
	void Clear();
	TF_Gamestats_LevelStats_t	*FindOrAddMapStats( const char *szMapName );
#ifdef GAME_DLL
	void AppendCustomDataToSaveBuffer( CUtlBuffer &SaveBuffer );
	bool LoadCustomDataFromBuffer( CUtlBuffer &LoadBuffer );
#endif 

	bool													m_bValidData;
	TF_Gamestats_LevelStats_t								*m_pCurrentGame;
	CUtlDict<TF_Gamestats_LevelStats_t, unsigned short>		m_dictMapStats;
};

struct ClassStats_t
{
	int					iPlayerClass;		// which class these stats refer to
	int					iNumberOfRounds;	// how many times player has played this class
	RoundStats_t		accumulated;
	RoundStats_t		max;
	RoundStats_t		currentRound;

	RoundStats_t		accumulatedMVM;
	RoundStats_t		maxMVM;

	ClassStats_t()
	{
		iPlayerClass	= TF_CLASS_UNDEFINED;
		iNumberOfRounds = 0;
	}

	void AccumulateRound( const RoundStats_t &other )
	{
		iNumberOfRounds++;
		accumulated.AccumulateRound( other );
		currentRound = other;
	}

	void AccumulateMVMRound( const RoundStats_t &other )
	{
		iNumberOfRounds++;
		accumulatedMVM.AccumulateRound( other );
		currentRound = other;
	}
};

struct MapStats_t
{
	map_identifier_t	iMapID;				// which map these stats refer to
	int					iNumberOfRounds;	// how many times player has played this map
	RoundMapStats_t		accumulated;
	RoundMapStats_t		currentRound;

	MapStats_t()
	{
		iMapID = 0xFFFFFFFF;
		iNumberOfRounds = 0;
	}

	void AccumulateRound( const RoundMapStats_t &other )
	{
		iNumberOfRounds++;
		accumulated.AccumulateRound( other );
		currentRound = other;
	}
};

//=============================================================================
// Beta Map Stats
//=============================================================================

//=============================================================================
// Robot Destruction
struct RobotDestructionStats_t
{
	RobotDestructionStats_t();

	void	Clear();
	int		GetRobotInteractionCount();
	int		GetRobotCoreInteractionCount();
	int		GetFlagInteractionCount();

	// Robot Cores Collected
	int		iCoresCollectedByTeam[ TF_TEAM_COUNT ];

	// Collected By What Class
	int		iCoreCollectedByClass[ TF_CLASS_COUNT ];

	// Robots Killed By Type
	// eRobotType::NUM_ROBOT_TYPES
	int		iBlueRobotsKilledByType[ 3 ];
	int		iRedRobotsKilledByType[ 3 ];

	int		iRobotsDamageFromClass[ TF_CLASS_COUNT ];

	// Player Interaction
	int		iRobotInteraction[MAX_PLAYERS];
	int		iRobotCoreInteraction[MAX_PLAYERS];
	int		iFlagInteraction[MAX_PLAYERS];
};

//=============================================================================
// Cactus Canyon

//=============================================================================
// Passtime
struct PasstimeStats_t
{
	PasstimeStats_t() { Clear(); }
	void Clear();
	void AddBallFracSample( float f );
	void AddPassTravelDistSample( float f );

	// To get comprehensive class stats, we need an event log instead of a summary.
	// But for now this should cover what we need.
	// These class stats were specifically requested by Travis@br, in addition to
	// total kills by class. The total kills by class is tracked by TF already.
	struct Classes_t
	{
		int nTotalScores;
		int nTotalCarrySec;
	} classes[TF_CLASS_COUNT_ALL];

	struct RoundSummary_t
	{
		int nTotalPassesStarted;
		int nTotalPassesFailed;
		int nTotalPassesShotDown;
		int nTotalPassesCompleted;
		int nTotalPassesCompletedNearGoal;
		int nTotalPassesIntercepted;
		int nTotalPassesInterceptedNearGoal;
		int nTotalPassRequests;
		int nTotalTosses;
		int nTotalTossesCompleted;
		int nTotalTossesIntercepted;
		int nTotalTossesInterceptedNearGoal;
		int nTotalSteals;
		int nTotalStealsNearGoal; 
		int nTotalBallSpawnShots;
		int nTotalScores;
		int nTotalRecoveries;
		int nTotalCarrySec;
		int nTotalWinningTeamBallCarrySec;
		int nTotalLosingTeamBallCarrySec;
		int nTotalThrowCancels;
		int nTotalSpeedBoosts;
		int nTotalJumpPads;
		int nTotalCarrierSpeedBoosts;
		int nTotalCarrierJumpPads;
		int nTotalBallDeflects;
		int nBallNeutralSec;
		int nGoalType;
		int nRoundEndReason;
		int nRoundRemainingSec;
		int nRoundMaxSec;
		int nPlayersRedMax;
		int nPlayersBlueMax;
		int nScoreBlue;
		int nScoreRed;
		bool bStalemate;
		bool bSuddenDeath;
		bool bMeleeOnlySuddenDeath;

		// histogram used to create min/max/mean/med/mode/stdev stats
		uint32 nBallFracSampleCount;
		uint32 arrBallFracHist[ 256 ];
		uint32 nBallFracHistSum;

		// sample set used to create min/max/mean/med/stdev stats
		static const uint32 k_nMaxPassTravelDistSamples = 1024;
		uint32 nPassTravelDistSampleCount;
		uint16 arrPassTravelDistSamples[ k_nMaxPassTravelDistSamples ];
	} summary;
};

const char* GetGameTypeID();

#ifdef CLIENT_DLL
MapStats_t &GetMapStats( map_identifier_t iMapID );
#endif

#endif // TF_GAMESTATS_SHARED_H