mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-04 18:09:53 +03:00
1
This commit is contained in:
39
game/client/playerspawncache.cpp
Normal file
39
game/client/playerspawncache.cpp
Normal file
@@ -0,0 +1,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();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user