本文整理汇总了C++中XmlNodeRef::removeAllChilds方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlNodeRef::removeAllChilds方法的具体用法?C++ XmlNodeRef::removeAllChilds怎么用?C++ XmlNodeRef::removeAllChilds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNodeRef
的用法示例。
在下文中一共展示了XmlNodeRef::removeAllChilds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAdditionalMinimapData
//////////////////////////////////////////////////////////////////////////
//
// Allows the game code to write game-specific data into the minimap xml
// file on level export. Currently used to export data to StatsTool
//
//////////////////////////////////////////////////////////////////////////
bool CEditorGame::GetAdditionalMinimapData(XmlNodeRef output)
{
string classes = g_pGameCVars->g_telemetryEntityClassesToExport;
if(!classes.empty())
{
// additional data relating to StatsTool
XmlNodeRef statsNode = output->findChild("StatsTool");
if(!statsNode)
{
statsNode = GetISystem()->CreateXmlNode("StatsTool");
output->addChild(statsNode);
}
else
{
statsNode->removeAllChilds();
}
// first build a list of entity classes from the cvar
std::vector<IEntityClass*> interestingClasses;
int curPos = 0;
string currentClass = classes.Tokenize(",",curPos);
IEntitySystem* pES = GetISystem()->GetIEntitySystem();
if(IEntityClassRegistry* pClassReg = pES->GetClassRegistry())
{
while (!currentClass.empty())
{
if(IEntityClass* pClass = pClassReg->FindClass(currentClass.c_str()))
{
interestingClasses.push_back(pClass);
}
currentClass = classes.Tokenize(",",curPos);
}
}
// now iterate through all entities and save the ones which match the classes
if(interestingClasses.size() > 0)
{
IEntityItPtr it = pES->GetEntityIterator();
while(IEntity* pEntity = it->Next())
{
if(stl::find(interestingClasses, pEntity->GetClass()))
{
XmlNodeRef entityNode = GetISystem()->CreateXmlNode("Entity");
statsNode->addChild(entityNode);
entityNode->setAttr("class", pEntity->GetClass()->GetName());
Vec3 pos = pEntity->GetWorldPos();
entityNode->setAttr("x", pos.x);
entityNode->setAttr("y", pos.y);
entityNode->setAttr("z", pos.z);
}
}
}
}
return true;
}