Exemplo n.º 1
0
void cdxCDynamicWnd::DoOnDestroy()
{
	if(IsWindow())
		OnDestroying();

	m_iDisabled		=	1;
	m_pWnd			=	NULL;
	m_Map.RemoveAll();

	if(m_pSizeIcon)
	{
		m_pSizeIcon->DestroyWindow();
		delete m_pSizeIcon;

		m_pSizeIcon	=	NULL;
	}
}
Exemplo n.º 2
0
/// <summary>
///	ProcessDestroyed is a "delayed" destruction of entities
///	This allows for us to mark entities for deletion and
///	delete them in one pass.
///
///	More importantly, it allows us to safely traverse
///	the entity pool when do Updates, Render, and Tick.
///	A common scenario is when one entity (A) is destroyed while we're
///	traversing the entity pool, but another entity (B) in the pool is
///	still referencing that entity (A). This solves that problem.
///
///	Users should never need to explicitly delete entities themselves.
/// </summary>
void EntityManager::EntityManager_Impl::ProcessDestroyed()
{
    const int entity_pool_count = _entity_pool.size();
    auto entity_pool_begin = _entity_pool.begin();

    for (int i = entity_pool_count - 1; i >= 0; --i)
    {
        auto entity = _entity_pool.at(i);

        if (entity)
        {
            if (entity->IsDestroyed())
            {
                entity->OnDestroying();
                delete entity;
                entity = NULL;
                _entity_pool.erase(entity_pool_begin + i);
            }
        }
    }
}