| 38 | } |
| 39 | |
| 40 | NodeStatus ManualSelectorNode::tick() |
| 41 | { |
| 42 | const size_t children_count = children_nodes_.size(); |
| 43 | |
| 44 | if(children_count == 0) |
| 45 | { |
| 46 | return selectStatus(); |
| 47 | } |
| 48 | |
| 49 | bool repeat_last = false; |
| 50 | getInput(REPEAT_LAST_SELECTION, repeat_last); |
| 51 | |
| 52 | int idx = 0; |
| 53 | |
| 54 | if(repeat_last && previously_executed_idx_ >= 0) |
| 55 | { |
| 56 | idx = previously_executed_idx_; |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | setStatus(NodeStatus::RUNNING); |
| 61 | idx = selectChild(); |
| 62 | previously_executed_idx_ = idx; |
| 63 | |
| 64 | if(idx == NUM_SUCCESS) |
| 65 | { |
| 66 | return NodeStatus::SUCCESS; |
| 67 | } |
| 68 | if(idx == NUM_FAILURE) |
| 69 | { |
| 70 | return NodeStatus::FAILURE; |
| 71 | } |
| 72 | if(idx == NUM_RUNNING) |
| 73 | { |
| 74 | return NodeStatus::RUNNING; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | const NodeStatus ret = children_nodes_[idx]->executeTick(); |
| 79 | if(ret == NodeStatus::RUNNING) |
| 80 | { |
| 81 | running_child_idx_ = idx; |
| 82 | } |
| 83 | return ret; |
| 84 | } |
| 85 | |
| 86 | NodeStatus ManualSelectorNode::selectStatus() const |
| 87 | { |
nothing calls this directly
no test coverage detected