Example #1
0
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;
        }
    }
}
Example #2
0
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 );
    }
}