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,
402
402
}
403
403
// -------------------------------------------------
404
404
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
+
405
412
// function to be called recursively
406
413
std::function<void (const XMLElement*)> recursiveStep;
407
414
@@ -482,7 +489,7 @@ void VerifyXML(const std::string& xml_text,
482
489
}
483
490
else if (name == " BehaviorTree" )
484
491
{
485
- if (ID.empty ())
492
+ if (ID.empty () && behavior_tree_count > 1 )
486
493
{
487
494
ThrowError (line_number, " The tag <BehaviorTree> must have the "
488
495
" attribute [ID]" );
Original file line number Diff line number Diff line change @@ -104,11 +104,11 @@ TEST(PortTest, Descriptions)
104
104
<BehaviorTree ID="MainTree" _description="this is my tree" >
105
105
<Sequence>
106
106
<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"/>
108
108
</Sequence>
109
109
</BehaviorTree>
110
110
111
- <BehaviorTree ID="SubTree " _description="this is a subtree" >
111
+ <BehaviorTree ID="mySubTree " _description="this is a subtree" >
112
112
<NodeWithPorts name="third" in_port_B="99" />
113
113
</BehaviorTree>
114
114
You can’t perform that action at this time.
0 commit comments