Merge branch 'master' into feature/v2

This commit is contained in:
Lukas Rieger (Blue) 2022-06-05 22:03:17 +02:00
commit a4ce85b9f8
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -117,7 +117,7 @@ private static List<Vector2i> getRegions(BmMap map, Vector2i center, int radius)
List<Vector2i> regions = new ArrayList<>();
Vector2i halfCell = regionGrid.getGridSize().div(2);
int increasedRadiusSquared = (int) Math.pow(radius + Math.ceil(halfCell.length()), 2);
long increasedRadiusSquared = (long) Math.pow(radius + Math.ceil(halfCell.length()), 2);
for (Vector2i region : world.listRegions()) {
if (!regionFilter.test(region)) continue;
@ -125,7 +125,7 @@ private static List<Vector2i> getRegions(BmMap map, Vector2i center, int radius)
Vector2i min = regionGrid.getCellMin(region);
Vector2i regionCenter = min.add(halfCell);
if (regionCenter.distanceSquared(center) <= increasedRadiusSquared)
if (regionCenter.toLong().distanceSquared(center.toLong()) <= increasedRadiusSquared)
regions.add(region);
}