propagated the temporary fix for Neighbors up to A*
This commit is contained in:
parent
239054df49
commit
74eab48a6e
@ -117,6 +117,7 @@ TArray<AHexTile*> AAdventureMap::AStar(AHexTile* Start, AHexTile* Goal)
|
|||||||
|
|
||||||
// expand frontier & adjust path data
|
// expand frontier & adjust path data
|
||||||
for (AHexTile* Neighbor : Neighbors(Candidate)) {
|
for (AHexTile* Neighbor : Neighbors(Candidate)) {
|
||||||
|
if (Neighbor->Distance(Candidate) > 1) { continue; }
|
||||||
if (Processed.Contains(Neighbor)) { continue; }
|
if (Processed.Contains(Neighbor)) { continue; }
|
||||||
|
|
||||||
bool bInToExamine = ToExamine.Contains(Neighbor);
|
bool bInToExamine = ToExamine.Contains(Neighbor);
|
||||||
@ -144,14 +145,8 @@ TArray<AHexTile*> AAdventureMap::LinkPath(AHexTile* Start, AHexTile* Goal)
|
|||||||
|
|
||||||
while (iPathNode != Start) {
|
while (iPathNode != Start) {
|
||||||
Path.Emplace(iPathNode);
|
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;
|
iPathNode = iPathNode->CameFrom;
|
||||||
}
|
}
|
||||||
|
Algo::Reverse(Path);
|
||||||
return Path;
|
return Path;
|
||||||
}
|
}
|
@ -47,9 +47,6 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
||||||
TArray<AHexTile*> LinkPath(AHexTile* Start, AHexTile* Goal);
|
TArray<AHexTile*> LinkPath(AHexTile* Start, AHexTile* Goal);
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, Category = "debug")
|
|
||||||
bool bChainBroken;
|
|
||||||
|
|
||||||
|
|
||||||
// Player spawn section
|
// Player spawn section
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||||
|
Loading…
Reference in New Issue
Block a user