Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
902 B

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //----------------------------------------------------------------------------------------
  4. #include "cbase.h"
  5. #include "playerspawncache.h"
  6. //--------------------------------------------------------------------------------
  7. /*static*/ CPlayerSpawnCache &CPlayerSpawnCache::Instance()
  8. {
  9. static CPlayerSpawnCache s_Instance;
  10. return s_Instance;
  11. }
  12. CPlayerSpawnCache::CPlayerSpawnCache()
  13. {
  14. // Clear the cache
  15. Reset();
  16. // The only event we care about
  17. ListenForGameEvent( "game_newmap" );
  18. }
  19. void CPlayerSpawnCache::Reset()
  20. {
  21. V_memset( &m_Data, 0, sizeof( m_Data ) );
  22. }
  23. void CPlayerSpawnCache::FireGameEvent( IGameEvent *pEvent )
  24. {
  25. // On new map, clear the cache
  26. if ( FStrEq( pEvent->GetName(), "game_newmap" ) )
  27. {
  28. Reset();
  29. }
  30. }
  31. //--------------------------------------------------------------------------------