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


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

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


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

示例1: HandleNode

bool CResourceMapItem::HandleNode ( CXMLNode& Node, CElement* pParent, vector < CElement* >* pAdded, bool bIsDuringStart, CElement** pCreated )
{
    // Grab the name
    std::string strBuffer;
    strBuffer = Node.GetTagName ();

    // Handle it based on the tag name
    CElement* pNode = NULL;
    if ( strBuffer.compare ( "vehicle" ) == 0 )
    {
        pNode = m_pVehicleManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }
    else if ( strBuffer.compare ( "object" ) == 0 )
    {
        bool bIsLowLod = false;
        pNode = m_pObjectManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents, bIsLowLod );
    }
    else if ( strBuffer.compare ( "blip" ) == 0 )
    {
        CBlip* pBlip = m_pBlipManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
        pNode = pBlip;
        /*
        if ( pBlip )
        {
            pBlip->SetIsSynced ( bIsDuringStart );
        }
        */
    }
    else if ( strBuffer.compare ( "pickup" ) == 0 )
    {
        pNode = m_pPickupManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }
    else if ( strBuffer.compare ( "marker" ) == 0 )
    {
        CMarker* pMarker = m_pMarkerManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
        pNode = pMarker;
        /*
        if ( pMarker )
        {
            pMarker->SetIsSynced ( bIsDuringStart );
        }
        */
    }
    else if ( strBuffer.compare ( "radararea" ) == 0 )
    {
        CRadarArea* pRadarArea = m_pRadarAreaManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
        pNode = pRadarArea;
        /*
        if ( pRadarArea )
        {
            pRadarArea->SetIsSynced ( bIsDuringStart );
        }
        */
    }
    else if ( strBuffer.compare ( "team" ) == 0 )
    {
        pNode = m_pTeamManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }
    else if ( strBuffer.compare ( "ped" ) == 0 )
    {
        pNode = m_pPedManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }
    else if ( strBuffer.compare ( "water" ) == 0 )
    {
        pNode = m_pWaterManager->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }
    else if ( strBuffer.empty () )
    {
        // Comment, return true
        return true;
    }
    else
    {
        pNode = m_pGroups->CreateFromXML ( pParent, Node, m_pVM, m_pEvents );
    }

    // Set the node we created in the pointer we were given
    if ( pCreated )
    {
        *pCreated = pNode;
    }

    // Got a node created?
    if ( pNode )
    {
        // Set its typename to the name of the tag
        pNode->SetTypeName ( strBuffer.c_str () );

        // Add it to our list over elements added
        if ( pAdded )
        {
            pAdded->push_back ( pNode );
        }

        // Add this element to this map's element group
        if ( m_pElementGroup )
            m_pElementGroup->Add ( pNode );

        // Load the elements below it
        return LoadSubNodes ( Node, pNode, pAdded, bIsDuringStart );
//.........这里部分代码省略.........
开发者ID:EagleShen,项目名称:MTA,代码行数:101,代码来源:CResourceMapItem.cpp

示例2: HandleNode

bool CMapManager::HandleNode ( CResource& Loader, CXMLNode& Node, CElement* pParent, vector < CElement* >* pAdded, bool bIsDuringStart, CElement** pCreated )
{
    // Grab the name
    std::string strBuffer = Node.GetTagName ();

    EElementType elementType;
    StringToEnum ( strBuffer, elementType );

    // Handle it based on the tag name
    CElement* pNode = NULL;
    if ( elementType == CElement::VEHICLE )
    {
        pNode = m_pVehicleManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }
    else if ( elementType == CElement::OBJECT )
    {
        bool bIsLowLod = false;
        pNode = m_pObjectManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents, bIsLowLod );
    }
    else if ( elementType == CElement::BLIP )
    {
        CBlip* pBlip = m_pBlipManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
        pNode = pBlip;
        /*if ( pBlip )
        {
            pBlip->SetIsSynced ( bIsDuringStart );
        }*/
    }
    else if ( elementType == CElement::PICKUP )
    {
        pNode = m_pPickupManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }
    else if ( elementType == CElement::MARKER )
    {
        CMarker* pMarker = m_pMarkerManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
        pNode = pMarker;
        if ( pMarker )
        {
            pMarker->SetIsSynced ( bIsDuringStart );
        }
    }
    else if ( elementType == CElement::RADAR_AREA )
    {
        CRadarArea* pRadarArea = m_pRadarAreaManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
        pNode = pRadarArea;
        if ( pRadarArea )
        {
            pRadarArea->SetIsSynced ( bIsDuringStart );
        }
    }
    else if ( elementType == CElement::TEAM )
    {
        pNode = m_pTeamManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }
    else if ( elementType == CElement::PED )
    {
        pNode = m_pPedManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }
    else if ( elementType == CElement::WATER )
    {
        pNode = m_pWaterManager->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }
    else if ( strBuffer.empty () )
    {
        // Comment, return true
        return true;
    }
    else
    {
        pNode = m_pGroups->CreateFromXML ( pParent, Node, Loader.GetVirtualMachine (), m_pEvents );
    }

    // Set the node we created in the pointer we were given
    if ( pCreated )
    {
        *pCreated = pNode;
    }

    // Got a node created?
    if ( pNode )
    {
        // Set its typename to the name of the tag
        pNode->SetTypeName ( strBuffer );

        // Add it to our list over elements added
        if ( pAdded )
        {
            pAdded->push_back ( pNode );
        }

        // Add this element to the resource's element group so it's deleted with it
        CElementGroup* pElementGroup = Loader.GetElementGroup ();
        if ( pElementGroup )
            pElementGroup->Add ( pNode );

        // Load the elements below it
        return LoadSubNodes ( Loader, Node, pNode, pAdded, bIsDuringStart );
    }
    return false;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:100,代码来源:CMapManager.cpp


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