From 3efa351a0a92e1c9c26d341adc2d0d64783ffa16 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 12 Dec 2018 18:13:11 +0100 Subject: Fix Map.getSize() to return a Dimension --- src/subconscious/Map.java | 5 ++--- src/subconscious/Tile.java | 4 ++-- src/subconscious/graphics/MapScene.java | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/subconscious/Map.java b/src/subconscious/Map.java index 5f15a52..ef6fddb 100644 --- a/src/subconscious/Map.java +++ b/src/subconscious/Map.java @@ -133,9 +133,8 @@ public class Map { return getTile(pos.x, pos.y); } - // TODO fix this garbage - public int getSize() { - return this.size.width; + public Dimension getSize() { + return this.size; } public ArrayList getActors() { diff --git a/src/subconscious/Tile.java b/src/subconscious/Tile.java index 1bccdb2..7323d38 100644 --- a/src/subconscious/Tile.java +++ b/src/subconscious/Tile.java @@ -37,7 +37,7 @@ public class Tile { out.add(map.getTile(this.getX()-1, this.getY())); } - if (this.getX() < map.getSize()-1) { + if (this.getX() < map.getSize().width -1) { out.add(map.getTile(this.getX()+1, this.getY())); } @@ -45,7 +45,7 @@ public class Tile { out.add(map.getTile(this.getX(), this.getY()-1)); } - if (this.getY() < map.getSize()-1) { + if (this.getY() < map.getSize().width -1) { out.add(map.getTile(this.getX(), this.getY()+1)); } diff --git a/src/subconscious/graphics/MapScene.java b/src/subconscious/graphics/MapScene.java index feb041a..c7f4167 100644 --- a/src/subconscious/graphics/MapScene.java +++ b/src/subconscious/graphics/MapScene.java @@ -76,7 +76,7 @@ public abstract class MapScene extends Scene { * if there is not tile under screenPos the return value is null */ protected Point tileAtCoordinates(Point screenPos) { - Rectangle mapRect = new Rectangle(0, 0, this.map.getSize(), this.map.getSize()); + Rectangle mapRect = new Rectangle(0, 0, this.map.getSize().width, this.map.getSize().height); if (undoZoomTx == null || undoPanTx == null) { return null; @@ -159,7 +159,7 @@ public abstract class MapScene extends Scene { // draw a border around the map g.setColor(Palette.ORANGE); - int maxBound = this.map.getSize() * tileSize; + int maxBound = this.map.getSize().width * tileSize; g.drawRect(0, 0, maxBound, maxBound); } -- cgit v1.2.1