Merge pull request #93 from limbonaut/fix-get-root

Fix `LimboState::get_root` and `dispatch` freeze the process in case of nested HSMs
This commit is contained in:
Serhii Snitsaruk 2024-04-21 16:42:02 +02:00 committed by GitHub
commit af0250dc60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -29,11 +29,11 @@ void LimboState::_update_blackboard_plan() {
} }
LimboState *LimboState::get_root() const { LimboState *LimboState::get_root() const {
const LimboState *state = this; const Node *state = this;
while (state->get_parent() && IS_CLASS(state->get_parent(), LimboState)) { while (state->get_parent() && IS_CLASS(state->get_parent(), LimboState)) {
state = Object::cast_to<LimboState>(get_parent()); state = state->get_parent();
} }
return const_cast<LimboState *>(state); return const_cast<LimboState *>(Object::cast_to<LimboState>(state));
} }
LimboState *LimboState::named(const String &p_name) { LimboState *LimboState::named(const String &p_name) {