diff options
Diffstat (limited to 'game/client/playerspawncache.cpp')
| -rw-r--r-- | game/client/playerspawncache.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/game/client/playerspawncache.cpp b/game/client/playerspawncache.cpp new file mode 100644 index 0000000..7c5d4cf --- /dev/null +++ b/game/client/playerspawncache.cpp @@ -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(); + } +} + +//--------------------------------------------------------------------------------
\ No newline at end of file |