propagated the temporary fix for Neighbors up to A*

This commit is contained in:
Maximilian Fajnberg 2022-01-18 20:19:30 +01:00
parent 239054df49
commit 74eab48a6e
2 changed files with 2 additions and 10 deletions

View File

@ -117,6 +117,7 @@ TArray<AHexTile*> 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<AHexTile*> 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;
}

View File

@ -47,9 +47,6 @@ public:
UFUNCTION(BlueprintCallable, Category = "Runtime")
TArray<AHexTile*> LinkPath(AHexTile* Start, AHexTile* Goal);
UPROPERTY(BlueprintReadOnly, Category = "debug")
bool bChainBroken;
// Player spawn section
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)