当前位置: 首页>>代码示例>>C++>>正文


C++ CElement::IsBeingDeleted方法代码示例

本文整理汇总了C++中CElement::IsBeingDeleted方法的典型用法代码示例。如果您正苦于以下问题:C++ CElement::IsBeingDeleted方法的具体用法?C++ CElement::IsBeingDeleted怎么用?C++ CElement::IsBeingDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CElement的用法示例。


在下文中一共展示了CElement::IsBeingDeleted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CallEventNoParent

void CElement::CallEventNoParent ( const char* szName, const CLuaArguments& Arguments, CElement* pSource, CPlayer* pCaller )
{
    // Call it on us if this isn't the same class it was raised on
    if ( pSource != this && m_pEventManager->HasEvents () )
    {
        m_pEventManager->Call ( szName, Arguments, pSource, this, pCaller );
    }

    // Call it on all our children
    CElementListSnapshot* pList = GetChildrenListSnapshot();
    pList->AddRef();    // Keep list alive during use
    for ( CElementListSnapshot::const_iterator iter = pList->begin() ; iter != pList->end() ; iter++ )
    {
        CElement* pElement = *iter;
        if ( !pElement->IsBeingDeleted() )
        {
            if ( !pElement->m_pEventManager || pElement->m_pEventManager->HasEvents () || !pElement->m_Children.empty () )
            {
                pElement->CallEventNoParent ( szName, Arguments, pSource, pCaller );
                if ( m_bIsBeingDeleted )
                    break;
            }
        }
    }
    pList->Release();
}
开发者ID:ljnx86,项目名称:mtasa-blue,代码行数:26,代码来源:CElement.cpp

示例2: _GetEntitiesFromRoot

void CElement::_GetEntitiesFromRoot ( unsigned int uiTypeHash, std::map < CElement*, int >& mapResults )
{
    t_mapEntitiesFromRoot::iterator find = ms_mapEntitiesFromRoot.find ( uiTypeHash );
    if ( find != ms_mapEntitiesFromRoot.end () )
    {
        CChildListType& listEntities = find->second;
        CElement* pEntity;
        unsigned int uiIndex = 0;

        for ( CChildListType::const_reverse_iterator i = listEntities.rbegin ();
              i != listEntities.rend ();
              ++i )
        {
            pEntity = *i;

            assert ( pEntity );
            ElementID ID = pEntity->GetID ();
            assert ( ID != INVALID_ELEMENT_ID );
            assert ( pEntity == CElementIDs::GetElement ( ID ) );
            if ( pEntity->IsBeingDeleted () )
                OutputDebugString ( SString ( "Server: 0x%08x  %s is flagged as IsBeingDeleted() but is still in GetEntitiesFromRoot\n", pEntity, pEntity->GetTypeName ().c_str () ) );

            assert ( mapResults.find ( pEntity ) == mapResults.end () );
            mapResults [ pEntity ] = 1;
        }
    }    
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:27,代码来源:CElement.cpp

示例3: lua_toelement

// Lua push/pop macros for our datatypes
CElement* lua_toelement ( lua_State* luaVM, int iArgument )
{
    if ( lua_type ( luaVM, iArgument ) == LUA_TLIGHTUSERDATA )
    {
        ElementID ID = TO_ELEMENTID ( lua_touserdata ( luaVM, iArgument ) );
        CElement* pElement = CElementIDs::GetElement ( ID );
        if ( !pElement || pElement->IsBeingDeleted () )
            return NULL;
        return pElement;
    }
    else if ( lua_type ( luaVM, iArgument ) == LUA_TUSERDATA )
    {
        ElementID ID = TO_ELEMENTID ( * ( ( void ** ) lua_touserdata ( luaVM, iArgument ) ) );
        CElement* pElement = CElementIDs::GetElement ( ID );
        if ( !pElement || pElement->IsBeingDeleted () )
            return NULL;
        return pElement;
    }

    return NULL;
}
开发者ID:Anubhav652,项目名称:mtasa-blue,代码行数:22,代码来源:LuaCommon.cpp

示例4: FindChildIndex

CElement* CElement::FindChildIndex ( const char* szName, unsigned int uiIndex, unsigned int& uiCurrentIndex, bool bRecursive )
{
    assert ( szName );

    // Look among our children
    CChildListType ::const_iterator iter = m_Children.begin ();
    for ( ; iter != m_Children.end (); iter++ )
    {
        // Name matches?
        if ( strcmp ( (*iter)->GetName ().c_str (), szName ) == 0 )
        {
            // Does the index match? If it doesn't, increment it and keep searching
            if ( uiIndex == uiCurrentIndex )
            {
                return *iter;
            }
            else
            {
                ++uiCurrentIndex;
            }
        }

        // Tell this child to search too if recursive
        if ( bRecursive )
        {
            CElement* pElement = (*iter)->FindChildIndex ( szName, uiIndex, uiCurrentIndex, true );
            if ( pElement )
            {
                if ( pElement->IsBeingDeleted() )
                {
                    // If it's being deleted right now we cannot return it. 
                    // Since we found a match we have to abort the search here.
                    return NULL;
                }
                return pElement;
            }
        }
    }

    // Doesn't exist within us
    return NULL;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:42,代码来源:CElement.cpp


注:本文中的CElement::IsBeingDeleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。