Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
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.

50 lines
1.4 KiB

5 years ago
//========= 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;
//----------------------------------------------------------------------------------------