Base functionality for MapObject placement

This commit is contained in:
2022-01-24 21:26:06 +01:00
parent 74eab48a6e
commit 237c056b30
8 changed files with 93 additions and 79 deletions

View File

@ -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) {