aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/playerspawncache.cpp
blob: 7c5d4cfa92cc3e30836b726356aa28dac24d7241 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//----------------------------------------------------------------------------------------

#include "cbase.h"
#include "playerspawncache.h"

//--------------------------------------------------------------------------------

/*static*/ CPlayerSpawnCache &CPlayerSpawnCache::Instance()
{
	static CPlayerSpawnCache s_Instance;
	return s_Instance;
}

CPlayerSpawnCache::CPlayerSpawnCache()
{
	// Clear the cache
	Reset();

	// The only event we care about
	ListenForGameEvent( "game_newmap" );
}

void CPlayerSpawnCache::Reset()
{
	V_memset( &m_Data, 0, sizeof( m_Data ) );
}

void CPlayerSpawnCache::FireGameEvent( IGameEvent *pEvent )
{
	// On new map, clear the cache
	if ( FStrEq( pEvent->GetName(), "game_newmap" ) )
	{
		Reset();
	}
}

//--------------------------------------------------------------------------------