Base functionality for MapObject placement
This commit is contained in:
@ -118,6 +118,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 (!(Neighbor->bFree)) { continue; }
|
||||
if (Processed.Contains(Neighbor)) { continue; }
|
||||
|
||||
bool bInToExamine = ToExamine.Contains(Neighbor);
|
||||
@ -134,13 +135,15 @@ TArray<AHexTile*> AAdventureMap::AStar(AHexTile* Start, AHexTile* Goal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LinkPath(Start, Goal);
|
||||
}
|
||||
|
||||
TArray<AHexTile*> AAdventureMap::LinkPath(AHexTile* Start, AHexTile* Goal)
|
||||
{
|
||||
TArray<AHexTile*> Path;
|
||||
|
||||
if (!IsValid(Goal->CameFrom)) { return Path; }
|
||||
|
||||
AHexTile* iPathNode = Goal;
|
||||
|
||||
while (iPathNode != Start) {
|
||||
|
Reference in New Issue
Block a user