added Distance function, quick fix for Neighbors function

This commit is contained in:
2022-01-13 16:54:37 +01:00
parent 219b99c8d7
commit 33de4f2fa6
4 changed files with 42 additions and 13 deletions
+8
View File
@@ -39,3 +39,11 @@ void AHexTile::FillCornersArray()
Corners.Emplace(Corner(i + 1));
}
}
int32 AHexTile::Distance(AHexTile* ToHex)
{
int32 CubeS1 = -this->Q - this->R;
int32 CubeS2 = -ToHex->Q - ToHex->R;
return (abs(this->Q - ToHex->Q) + abs(this->R - ToHex->R) + abs(CubeS1 - CubeS2)) / 2;
}