Allow the creation of recursive HTNs (#30138)

Allow recursive HTNs
This commit is contained in:
osjarw
2024-07-30 05:18:53 +03:00
committed by GitHub
parent cc3d6441be
commit 669cc55ba4
4 changed files with 21 additions and 0 deletions

View File

@@ -63,8 +63,13 @@ public sealed class HTNPlanJob : Job<HTNPlan>
// How many primitive tasks we've added since last record.
var primitiveCount = 0;
int tasksProcessed = 0;
while (tasksToProcess.TryDequeue(out var currentTask))
{
if (tasksProcessed++ > _rootTask.MaximumTasks)
throw new Exception("HTN Planner exceeded maximum tasks");
switch (currentTask)
{
case HTNCompoundTask compound: