本文整理汇总了C++中TSharedPtr::AppendSearchHistory方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::AppendSearchHistory方法的具体用法?C++ TSharedPtr::AppendSearchHistory怎么用?C++ TSharedPtr::AppendSearchHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::AppendSearchHistory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessExecutionRequest
//.........这里部分代码省略.........
NumStackElements = 0;
}
if(PreviousPlan.IsValid()) // we're doing plan reuse
{
if(bProbabilisticPlanReuse)
{
bHitLeaf = true;
}
// verify that all of our values of maximum streak lengths among unprocessed nodes are still correct
UpdateMaxStreakLengths();
}
continue;
}
// find all tasks that share the highest priority amongst the tasks in the task network
TArray<TSharedPtr<FHTNTaskInstance>> TaskInstances = TopNetwork->FindTasksWithoutPredecessors(StackTop.TaskNetwork->GetMemory());
for(const TSharedPtr<FHTNTaskInstance>& TaskInstance : TaskInstances)
{
UHTNTask* Task = TaskInstance->Task;
if(UPrimitiveTask* PrimitiveTask = Cast<UPrimitiveTask>(Task))
{
if(PrimitiveTask->IsApplicable(StackTop.WorldState, TaskInstance->GetMemory()))
{
// prepare a new element for the stack where we'll have applied this primitive task
FHTNStackElement NewStackElement;
NewStackElement.Cost =
FMath::Max(0.f, StackTop.Cost) + PrimitiveTask->GetCost(StackTop.WorldState, TaskInstance->GetMemory());
TSharedPtr<FHTNPlan> Plan = StackTop.Plan->Copy();
Plan->AppendTaskInstance(TaskInstance);
Plan->AppendSearchHistory(TaskInstance);
TSharedPtr<FHTNTaskInstance> TaskNetwork = TopNetwork->Copy(StackTop.TaskNetwork);
Cast<UTaskNetwork>(TaskNetwork->Task)->Remove(TaskInstance, TaskNetwork->GetMemory());
TSharedPtr<FHTNWorldState> WorldState = StackTop.WorldState->Copy();
PrimitiveTask->ApplyTo(WorldState, TaskInstance->GetMemory());
NewStackElement.Plan = Plan;
NewStackElement.TaskNetwork = TaskNetwork;
NewStackElement.WorldState = WorldState;
if(PreviousPlan.IsValid())
{
// we're doing plan reuse
CurrentMatchingStreakLength = Plan->GetMatchingStreak(PreviousPlan, MinMatchingStreakLength);
}
AddStackElement(NewStackElement); // TO DO maybe should explicitly Move the NewStackElement?
}
else if(PreviousPlan.IsValid())
{
if(bProbabilisticPlanReuse)
{
bHitLeaf = true;
}
}
}
else if(UCompoundTask* CompoundTask = Cast<UCompoundTask>(Task))
{
TArray<TSharedPtr<FHTNTaskInstance>> Decompositions = CompoundTask->FindDecompositions(*this, StackTop.WorldState,
TaskInstance->GetMemory());
// regardless of which decomposition we pick, effect on plan will be the same
TSharedPtr<FHTNPlan> Plan = StackTop.Plan->Copy();