diff --git a/AdventureMap.cpp b/AdventureMap.cpp index 1e11e49..3e4aeac 100644 --- a/AdventureMap.cpp +++ b/AdventureMap.cpp @@ -117,6 +117,7 @@ TArray AAdventureMap::AStar(AHexTile* Start, AHexTile* Goal) // expand frontier & adjust path data for (AHexTile* Neighbor : Neighbors(Candidate)) { + if (Neighbor->Distance(Candidate) > 1) { continue; } if (Processed.Contains(Neighbor)) { continue; } bool bInToExamine = ToExamine.Contains(Neighbor); @@ -144,14 +145,8 @@ TArray AAdventureMap::LinkPath(AHexTile* Start, AHexTile* Goal) while (iPathNode != Start) { Path.Emplace(iPathNode); - - if (iPathNode->Distance(iPathNode->CameFrom) > 1) { - bChainBroken = true; - UE_LOG(LogTemp, Warning, TEXT("Chain is broken in LinkPath function...")); - } - iPathNode = iPathNode->CameFrom; } - + Algo::Reverse(Path); return Path; } \ No newline at end of file diff --git a/AdventureMap.h b/AdventureMap.h index a5844d5..c5caa76 100644 --- a/AdventureMap.h +++ b/AdventureMap.h @@ -47,9 +47,6 @@ public: UFUNCTION(BlueprintCallable, Category = "Runtime") TArray LinkPath(AHexTile* Start, AHexTile* Goal); - UPROPERTY(BlueprintReadOnly, Category = "debug") - bool bChainBroken; - // Player spawn section UPROPERTY(VisibleAnywhere, BlueprintReadWrite)