File tree Expand file tree Collapse file tree 1 file changed +39
-2
lines changed
Server/mods/deathmatch/logic Expand file tree Collapse file tree 1 file changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -894,8 +894,45 @@ bool CMainConfig::AddMissingSettings()
894894 // Skip certain optional nodes
895895 if (templateNodeName == " resource" || templateNodeName == " module" )
896896 continue ;
897-
898- CXMLNode* foundNode = m_pRootNode->FindSubNode (templateNodeName.c_str ());
897+
898+ // Find node with exact same attributes
899+ CXMLAttributes& templateAttributes = templateNode->GetAttributes ();
900+ CXMLNode* foundNode = nullptr ;
901+ for (auto it2 = m_pRootNode->ChildrenBegin (); it2 != m_pRootNode->ChildrenEnd (); ++it2)
902+ {
903+ CXMLNode* tempNode = *it2;
904+ if (tempNode->GetTagName () != templateNodeName)
905+ continue ;
906+
907+ CXMLAttributes& attributes = tempNode->GetAttributes ();
908+ bool attributesMatch = true ;
909+
910+ for (auto it3 = templateAttributes.ListBegin (); it3 != templateAttributes.ListEnd (); ++it3)
911+ {
912+ CXMLAttribute* templateAttribute = *it3;
913+ const SString& attrName = templateAttribute->GetName ();
914+
915+ // Don't check value attribute which is intended to be different
916+ if (attrName == " value" )
917+ continue ;
918+
919+ const SString& attrValue = templateAttribute->GetValue ();
920+
921+ CXMLAttribute* foundAttribute = attributes.Find (attrName);
922+ if (!foundAttribute || foundAttribute->GetValue () != attrValue)
923+ {
924+ attributesMatch = false ;
925+ break ;
926+ }
927+ }
928+
929+ if (attributesMatch)
930+ {
931+ foundNode = tempNode;
932+ break ;
933+ }
934+ }
935+
899936 if (!foundNode)
900937 {
901938 const std::string templateNodeValue = templateNode->GetTagContent ();
You can’t perform that action at this time.
0 commit comments