Minor improvements

This commit is contained in:
Wojtek Figat
2023-09-19 21:37:24 +02:00
parent e9cf188c2d
commit f0b5d3b838
3 changed files with 12 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ void Behavior::OnDisable()
bool Behavior::GetNodeDebugRelevancy(const BehaviorTreeNode* node, const Behavior* behavior)
{
return node && behavior && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex);
return node && behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex);
}
String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavior)
@@ -180,7 +180,7 @@ String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavi
return String::Empty;
BehaviorUpdateContext context;
Platform::MemoryClear(&context, sizeof(context));
if (behavior && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex))
if (behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex))
{
// Pass behavior and knowledge data only for relevant nodes to properly access it
context.Behavior = behavior;