Removed canMoveToTarget unnecessary cell Y border intersection check.

This commit is contained in:
MobiusDevelopment
2021-12-25 04:14:34 +00:00
parent f4e1599e0f
commit 9e7f8fbba7
25 changed files with 75 additions and 250 deletions

View File

@@ -712,9 +712,8 @@ public class GeoEngine
final double m = (double) dy / dx;
final MoveDirectionType mdt = MoveDirectionType.getDirection(gtx - gox, gty - goy);
// Get cell grid coordinates.
// Get cell grid X coordinate.
int gridX = ox & 0xFFFFFFF0;
int gridY = oy & 0xFFFFFFF0;
// Run loop.
byte dir;
@@ -723,8 +722,8 @@ public class GeoEngine
while ((gox != gtx) || (goy != gty))
{
// Calculate intersection with cell's X border.
int checkX = gridX + mdt.getOffsetX();
int checkY = (int) (oy + (m * (checkX - ox)));
final int checkX = gridX + mdt.getOffsetX();
final int checkY = (int) (oy + (m * (checkX - ox)));
if ((mdt.getStepX() != 0) && (getGeoY(checkY) == goy))
{
@@ -735,13 +734,7 @@ public class GeoEngine
}
else
{
// Calculate intersection with cell's Y border.
checkY = gridY + mdt.getOffsetY();
checkX = (int) (ox + ((checkY - oy) / m));
checkX = Util.limit(checkX, gridX, gridX + 15);
// Set next cell in Y direction.
gridY += mdt.getStepY();
ny += mdt.getSignumY();
dir = mdt.getDirectionY();
}