area51/Support/ManagerRegistration.cpp

59 lines
1.5 KiB
C++
Raw Permalink Normal View History

2021-08-28 04:22:41 +02:00
#include "ManagerRegistration.hpp"
//=========================================================================
// GAMER MANAGERS REGISTRATION
//=========================================================================
reg_game_mgrs g_RegGameMgrs;
//=========================================================================
void reg_game_mgrs::AddManager( const char* pManagerName, prop_interface* pInterface )
{
reg_game_mgr Mgr;
Mgr.Create(pManagerName, pInterface);
m_lstMgrs.Append(Mgr);
}
//=========================================================================
prop_interface* reg_game_mgrs::GetManagerInterface( const char* pManagerName )
{
ASSERT(pManagerName);
for (s32 i = 0; i < m_lstMgrs.GetCount(); i++)
{
reg_game_mgr& Mgr = m_lstMgrs.GetAt(i);
if( x_stricmp( pManagerName, Mgr.ManagerName ) == 0 )
return Mgr.pInterface;
}
return NULL;
}
//=========================================================================
s32 reg_game_mgrs::GetCount()
{
return m_lstMgrs.GetCount();
}
//=========================================================================
const char* reg_game_mgrs::GetName(s32 Index)
{
ASSERT(Index < m_lstMgrs.GetCount());
reg_game_mgr& Mgr = m_lstMgrs.GetAt(Index);
return Mgr.ManagerName;
}
//=========================================================================
prop_interface* reg_game_mgrs::GetInterface(s32 Index)
{
ASSERT(Index < m_lstMgrs.GetCount());
reg_game_mgr& Mgr = m_lstMgrs.GetAt(Index);
return Mgr.pInterface;
}