From 2599db2e6de252d70f7319ca33cca2cfbc259020 Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Mon, 4 Jun 2018 12:38:35 -0400 Subject: [PATCH] perspective: fix getCanvasTileAreaPoly for even number sizes --- .../src/main/java/net/runelite/api/Perspective.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 1309ef598e..8b4e801f3d 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -291,14 +291,10 @@ public class Perspective public static Polygon getCanvasTileAreaPoly(@Nonnull Client client, @Nonnull LocalPoint localLocation, int size) { int plane = client.getPlane(); - int halfTile = LOCAL_TILE_SIZE / 2; - - // If the size is 5, we need to shift it up and left 2 units, then expand by 5 units to make a 5x5 - int aoeSize = size / 2; // Shift over one half tile as localLocation is the center point of the tile, and then shift the area size - Point southWestCorner = new Point(localLocation.getX() - (aoeSize * LOCAL_TILE_SIZE) - halfTile + 1, - localLocation.getY() - (aoeSize * LOCAL_TILE_SIZE) - halfTile + 1); + Point southWestCorner = new Point(localLocation.getX() - (size * LOCAL_TILE_SIZE / 2), + localLocation.getY() - (size * LOCAL_TILE_SIZE / 2)); // expand by size Point northEastCorner = new Point(southWestCorner.getX() + size * LOCAL_TILE_SIZE - 1, southWestCorner.getY() + size * LOCAL_TILE_SIZE - 1);