aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/episodic/ep1_gamestats.cpp
blob: a82c27db091540a6f72487b6d6c6994f54a6d70c (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

//Gamestats was built for ep1, so this file is going to be amazingly short seeing as how ep1 set the standard

#include "cbase.h"
#include "ep1_gamestats.h"
#include "tier1/utlbuffer.h"
static CEP1GameStats s_CEP1GS_ThisJustSitsInMemory;

// A bit of a hack to redirect the gamestats API for ep2 (ep3, etc.)
extern CBaseGameStats *g_pEP2GameStats;

CEP1GameStats::CEP1GameStats( void )
{
	gamestats = &s_CEP1GS_ThisJustSitsInMemory;
}

CBaseGameStats *CEP1GameStats::OnInit( CBaseGameStats *pCurrentGameStats, char const *gamedir )
{
	if ( !Q_stricmp( gamedir, "ep2" ) )
	{
		return g_pEP2GameStats;
	}

	return pCurrentGameStats;
}

const char *CEP1GameStats::GetStatSaveFileName( void )
{
	return "ep1_gamestats.dat"; //overriding the default for backwards compatibility with release stat tracking code
}

const char *CEP1GameStats::GetStatUploadRegistryKeyName( void )
{
	return "GameStatsUpload_Ep1"; //overriding the default for backwards compatibility with release stat tracking code
}


static char const *ep1Maps[] =
{
		"ep1_citadel_00",
		"ep1_citadel_01",
		"ep1_citadel_02",
		"ep1_citadel_02b",
		"ep1_citadel_03",
		"ep1_citadel_04",
		"ep1_c17_00",
		"ep1_c17_00a",
		"ep1_c17_01",
		"ep1_c17_02",
		"ep1_c17_02b",
		"ep1_c17_02a",
		"ep1_c17_05",
		"ep1_c17_06",
};


bool CEP1GameStats::UserPlayedAllTheMaps( void )
{
	int c = ARRAYSIZE( ep1Maps );
	for ( int i = 0; i < c; ++i )
	{
		int idx = m_BasicStats.m_MapTotals.Find( ep1Maps[ i ] );
		if( idx == m_BasicStats.m_MapTotals.InvalidIndex() )
			return false;
	}

	return true;
}