Skip to content

Commit

Permalink
Update BehaviorKit.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Dec 14, 2023
1 parent 87c4d6e commit de6183a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions libs/BehaviorKit/source/BehaviorKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ void BehaviorKit::start(interface::Behavior *behavior)

void BehaviorKit::start(BehaviorID id)
{
// interface::Behavior *found_behavior = nullptr;
interface::Behavior *found_behavior = nullptr;

// for (auto *behavior: _behaviors) {
// if (id == behavior->id()) {
// found_behavior = behavior;
// break;
// }
// }
for (auto *behavior: _behaviors) {
if (id == behavior->id()) {
found_behavior = behavior;
break;
}
}

// start(found_behavior);
start(found_behavior);

// ? : ALTERNATIVE
auto predicate = [&id](interface::Behavior *b) { return id == b->id(); };
auto found_behavior = std::find_if(_behaviors.begin(), _behaviors.end(), predicate);
// auto predicate = [&id](interface::Behavior *b) { return id == b->id(); };
// auto found_behavior = std::find_if(_behaviors.begin(), _behaviors.end(), predicate);

start(*found_behavior);
// start(*found_behavior);
}

void BehaviorKit::run()
Expand Down

0 comments on commit de6183a

Please sign in to comment.