1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00
hl2sdk/game/client/playerspawncache.cpp

39 lines
940 B
C++
Raw Normal View History

2013-06-27 06:22:04 +08:00
//========= 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();
}
}
//--------------------------------------------------------------------------------