/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/core/gamecode/engine.cpp

*/

#include "sgx/core/core.hpp"


void
CSGXEngine::initialize()
{
	CSGXBaseEngine::initialize();
	CSGXHappening::get()->addEngine(this);
}

void
CSGXEngine::release()
{
	CSGXBaseEngine::release();
	CSGXHappening::get()->removeEngine(this);
}

tBOOL 
CSGXEngine::registerObject(CGameHandler *ptr)
{
	sgxAssert(find(m_EngineObjects.begin(), m_EngineObjects.end(), ptr) == m_EngineObjects.end());

	CSGXBaseEngine::registerObject(ptr);

	// *All* engine objects are added to the management engine's master list
	CSGXManagementEngine::get()->registerObject(ptr);
	return TRUE;
}

tBOOL 
CSGXEngine::unregisterObject(CGameHandler *ptr)
{
	// *All* engine objects are added to the management engine's master list
	CSGXManagementEngine::get()->unregisterObject(ptr);

	return CSGXBaseEngine::unregisterObject(ptr);
}
