Fixed freezes on controller calling MarkPath() to invalid locations
This commit is contained in:
@@ -59,7 +59,6 @@ TArray<AHexTile*> AAdventurePlayerController::Vision(int32 Radius)
|
||||
{
|
||||
TArray<AHexTile*> Results;
|
||||
TSet<AHexTile*> Visible;
|
||||
if (CurrentHex->bDiagMove) { Radius = FMath::FloorToInt(float(Radius) * (2.f / 3.f)); }
|
||||
Visible = MapRef->BreadthFirstSearch(CurrentHex, Radius);
|
||||
for (auto& Hex : Visible) {
|
||||
if (ExploredHexes.Contains(Hex)) { continue; }
|
||||
@@ -71,6 +70,10 @@ TArray<AHexTile*> AAdventurePlayerController::Vision(int32 Radius)
|
||||
|
||||
void AAdventurePlayerController::MarkPath(TArray<AHexTile*> Path)
|
||||
{
|
||||
if (Path.IsEmpty()) { return; }
|
||||
else if (!IsValid(Path[0])) { return; }
|
||||
else if (CurrentHex->Distance(Path[0])>1) { return; }
|
||||
|
||||
FHexVector DirA = FHexVector(Path[0]->Q - CurrentHex->Q, Path[0]->R - CurrentHex->R);
|
||||
FHexVector DirB;
|
||||
for (int32 i = 0; i < Path.Num() - 1; i++)
|
||||
|
||||
Reference in New Issue
Block a user