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


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

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


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

示例1: switch

CElementGroup::~CElementGroup()
{
    // Delete all the elements
    if (!m_elements.empty())
    {
        if (!g_pGame->IsBeingDeleted())
        {
            CEntityRemovePacket removePacket;

            for (CFastList<CElement*>::iterator iter = m_elements.begin(); iter != m_elements.end(); iter++)
            {
                CElement* pElement = (*iter);

                switch (pElement->GetType())
                {
                    case CElement::DATABASE_CONNECTION:
                    case CElement::SCRIPTFILE:
                        continue;
                    default:
                        break;
                }
                // Tell everyone to destroy it if this is not a per-player entity
                if (pElement->IsPerPlayerEntity())
                {
                    // Unsync it (will destroy it for those that know about it)
                    CPerPlayerEntity* pEntity = static_cast<CPerPlayerEntity*>(pElement);
                    pEntity->Sync(false);
                }
                else
                {
                    // Tell everyone to destroy it
                    removePacket.Add(pElement);
                }
            }

            g_pGame->GetPlayerManager()->BroadcastOnlyJoined(removePacket);
        }

        CElementDeleter* deleter = g_pGame->GetElementDeleter();
        CElement*        pElement = NULL;
        for (CFastList<CElement*>::iterator iter = m_elements.begin(); iter != m_elements.end(); iter++)
        {
            pElement = *iter;
            pElement->SetElementGroup(NULL);
            pElement->DeleteAllEvents();
            deleter->Delete(pElement, true, false);
        }

        // Do this at the end for speed
        g_pGame->GetMapManager()->GetRootElement()->UpdatePerPlayerEntities();
    }
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:52,代码来源:CElementGroup.cpp

示例2: BroadcastElementChildren

void CMapManager::BroadcastElementChildren ( CElement* pParentElement, CEntityAddPacket &Packet, std::vector < CPerPlayerEntity* > &pPerPlayerList, std::set < CElement* >& outDoneElements )
{
    CChildListType ::const_iterator iter = pParentElement->IterBegin ();
    for ( ; iter != pParentElement->IterEnd(); iter++ )
    {
        CElement* pChildElement = *iter;
        MapInsert( outDoneElements, pChildElement );

        // Is it a per-player entity
        if ( pChildElement->IsPerPlayerEntity () )
        {
            pPerPlayerList.push_back ( static_cast < CPerPlayerEntity* > ( pChildElement ) );
        }
        else
        {
            Packet.Add ( pChildElement );
        }

        if ( pChildElement->CountChildren() > 0 )
            BroadcastElementChildren ( pChildElement, Packet, pPerPlayerList, outDoneElements );
    }
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:22,代码来源:CMapManager.cpp

示例3: BroadcastElementChildren

void CMapManager::BroadcastElementChildren ( CElement* pElement, CEntityAddPacket &Packet, list < CPerPlayerEntity* > &pPerPlayerList, bool bBroadcastAll )
{
    CElement * pTemp;
    CChildListType ::const_iterator iter = pElement->IterBegin ();
    for ( ; iter != pElement->IterEnd(); iter++ )
    {
        pTemp = *iter;
        // Is this a map created entity or our resource's root element
        if ( bBroadcastAll || ( pTemp->IsMapCreated () || ( pTemp->GetType () == CElement::DUMMY && !strcmp ( pTemp->GetTypeName ().c_str (), "map" ) ) ) )
        {
            // Is it a per-player entity
            if ( pTemp->IsPerPlayerEntity () )
            {
                pPerPlayerList.push_back ( static_cast < CPerPlayerEntity* > ( pTemp ) );
            }
            else
            {
                Packet.Add ( pTemp );
            }
        }
        if ( pTemp->CountChildren() > 0 ) BroadcastElementChildren ( pTemp, Packet, pPerPlayerList, bBroadcastAll );
    }
}
开发者ID:EagleShen,项目名称:MTA,代码行数:23,代码来源:CMapManager.cpp


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