本文整理汇总了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();
}
}
示例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 );
}
}
示例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 );
}
}