mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 17:59:37 +00:00
1
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#include "thinkmanager.h"
|
||||
#include "ithinker.h"
|
||||
#include "replay/ienginereplay.h"
|
||||
#include "replay_dbg.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
extern IEngineReplay *g_pEngine;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
void CThinkManager::AddThinker( IThinker *pThinker )
|
||||
{
|
||||
Assert( m_lstManagers.Find( pThinker ) == m_lstManagers.InvalidIndex() );
|
||||
m_lstManagers.AddToTail( pThinker );
|
||||
}
|
||||
|
||||
void CThinkManager::RemoveThinker( IThinker *pThinker )
|
||||
{
|
||||
int it = m_lstManagers.Find( pThinker ); Assert( it != m_lstManagers.InvalidIndex() );
|
||||
m_lstManagers.Remove( it );
|
||||
}
|
||||
|
||||
void CThinkManager::Think()
|
||||
{
|
||||
FOR_EACH_LL( m_lstManagers, i )
|
||||
{
|
||||
IThinker *pCurThinker = m_lstManagers[ i ];
|
||||
if ( !pCurThinker->ShouldThink() )
|
||||
continue;
|
||||
|
||||
pCurThinker->Think();
|
||||
pCurThinker->PostThink();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
static CThinkManager s_ThinkManager;
|
||||
IThinkManager *g_pThinkManager = &s_ThinkManager;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user