@@ -22,31 +22,54 @@ NodeStatus ReactiveFallback::tick()
22
22
for (size_t index = 0 ; index < childrenCount (); index++)
23
23
{
24
24
TreeNode* current_child_node = children_nodes_[index];
25
- const NodeStatus child_status = current_child_node-> executeTick () ;
25
+ NodeStatus child_status = NodeStatus::IDLE ;
26
26
27
- switch (child_status)
27
+ if (current_child_node->type () != NodeType::ACTION_ASYNC)
28
+ {
29
+ child_status = current_child_node->executeTick ();
30
+ }
31
+ else
28
32
{
29
- case NodeStatus::RUNNING:
33
+ if (current_child_node-> status () != NodeStatus::RUNNING)
30
34
{
31
- haltChildren (index+1 );
32
- return NodeStatus::RUNNING;
33
- }
35
+ // if not running already, tick it
36
+ current_child_node->executeTick ();
37
+ do
38
+ {
34
39
35
- case NodeStatus::FAILURE:
36
- {
37
- failure_count++;
38
- }break ;
40
+ child_status = current_child_node->status ();
39
41
40
- case NodeStatus::SUCCESS:
41
- {
42
- haltChildren (0 );
43
- return NodeStatus::SUCCESS;
42
+ } while (child_status == NodeStatus::IDLE);
44
43
}
45
-
46
- case NodeStatus::IDLE:
44
+ else
47
45
{
48
- throw LogicError ( " A child node must never return IDLE " ) ;
46
+ child_status = NodeStatus::RUNNING ;
49
47
}
48
+ }
49
+
50
+ switch (child_status)
51
+ {
52
+ case NodeStatus::RUNNING:
53
+ {
54
+ haltChildren (index+1 );
55
+ return NodeStatus::RUNNING;
56
+ }break ;
57
+
58
+ case NodeStatus::FAILURE:
59
+ {
60
+ failure_count++;
61
+ }break ;
62
+
63
+ case NodeStatus::SUCCESS:
64
+ {
65
+ haltChildren (index+1 );
66
+ return NodeStatus::SUCCESS;
67
+ }break ;
68
+
69
+ case NodeStatus::IDLE:
70
+ {
71
+ throw LogicError (" A child node must never return IDLE" );
72
+ }
50
73
} // end switch
51
74
} // end for
52
75
0 commit comments