File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,13 @@ void VerifyXML(const std::string& xml_text,
402402 }
403403 // -------------------------------------------------
404404
405+ int behavior_tree_count = 0 ;
406+ for (auto child = xml_root->FirstChildElement (); child != nullptr ;
407+ child = child->NextSiblingElement ())
408+ {
409+ behavior_tree_count++;
410+ }
411+
405412 // function to be called recursively
406413 std::function<void (const XMLElement*)> recursiveStep;
407414
@@ -482,7 +489,7 @@ void VerifyXML(const std::string& xml_text,
482489 }
483490 else if (name == " BehaviorTree" )
484491 {
485- if (ID.empty ())
492+ if (ID.empty () && behavior_tree_count > 1 )
486493 {
487494 ThrowError (line_number, " The tag <BehaviorTree> must have the "
488495 " attribute [ID]" );
Original file line number Diff line number Diff line change @@ -104,11 +104,11 @@ TEST(PortTest, Descriptions)
104104 <BehaviorTree ID="MainTree" _description="this is my tree" >
105105 <Sequence>
106106 <NodeWithPorts name="first" in_port_B="66" _description="this is my action" />
107- <SubTree ID="SubTree " name="second" _description="this is a subtree"/>
107+ <SubTree ID="mySubTree " name="second" _description="this is a subtree"/>
108108 </Sequence>
109109 </BehaviorTree>
110110
111- <BehaviorTree ID="SubTree " _description="this is a subtree" >
111+ <BehaviorTree ID="mySubTree " _description="this is a subtree" >
112112 <NodeWithPorts name="third" in_port_B="99" />
113113 </BehaviorTree>
114114
You can’t perform that action at this time.
0 commit comments