| 165 | } |
| 166 | |
| 167 | void BehaviorKnowledge::FreeMemory() |
| 168 | { |
| 169 | if (Memory) |
| 170 | { |
| 171 | // Release any outstanding nodes state and memory |
| 172 | ASSERT_LOW_LAYER(Tree); |
| 173 | BehaviorUpdateContext context; |
| 174 | context.Behavior = Behavior; |
| 175 | context.Knowledge = this; |
| 176 | context.Memory = Memory; |
| 177 | context.RelevantNodes = &RelevantNodes; |
| 178 | context.DeltaTime = 0.0f; |
| 179 | context.Time = 0.0f; |
| 180 | for (const auto& node : Tree->Graph.Nodes) |
| 181 | { |
| 182 | if (node.Instance && node.Instance->_executionIndex != -1 && RelevantNodes[node.Instance->_executionIndex]) |
| 183 | node.Instance->ReleaseState(context); |
| 184 | } |
| 185 | Allocator::Free(Memory); |
| 186 | Memory = nullptr; |
| 187 | } |
| 188 | RelevantNodes.Clear(); |
| 189 | Blackboard.DeleteValue(); |
| 190 | for (Variant& goal : Goals) |
| 191 | goal.DeleteValue(); |
| 192 | Goals.Resize(0); |
| 193 | Tree = nullptr; |
| 194 | } |
| 195 | |
| 196 | bool BehaviorKnowledge::Get(const StringAnsiView& path, Variant& value) const |
| 197 | { |
no test coverage detected