mirror of
https://github.com/edubart/otclient.git
synced 2025-12-20 23:47:12 +01:00
restore terminal, rework console
This commit is contained in:
@@ -95,6 +95,13 @@ void OTMLNode::addChild(const OTMLNodePtr& newChild)
|
||||
for(const OTMLNodePtr& node : m_children) {
|
||||
if(node->tag() == newChild->tag() && (node->isUnique() || newChild->isUnique())) {
|
||||
newChild->setUnique(true);
|
||||
|
||||
if(node->hasChildren() && newChild->hasChildren()) {
|
||||
OTMLNodePtr tmpNode = node->clone();
|
||||
tmpNode->merge(newChild);
|
||||
newChild->copy(tmpNode);
|
||||
}
|
||||
|
||||
replaceChild(node, newChild);
|
||||
|
||||
// remove any other child with the same tag
|
||||
@@ -140,6 +147,18 @@ bool OTMLNode::replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newC
|
||||
return false;
|
||||
}
|
||||
|
||||
void OTMLNode::copy(const OTMLNodePtr& node)
|
||||
{
|
||||
setTag(node->tag());
|
||||
setValue(node->value());
|
||||
setUnique(node->isUnique());
|
||||
setNull(node->isNull());
|
||||
setSource(node->source());
|
||||
clear();
|
||||
for(const OTMLNodePtr& child : node->m_children)
|
||||
addChild(child->clone());
|
||||
}
|
||||
|
||||
void OTMLNode::merge(const OTMLNodePtr& node)
|
||||
{
|
||||
for(const OTMLNodePtr& child : node->m_children)
|
||||
|
||||
Reference in New Issue
Block a user