summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-12 18:13:11 +0100
committerNao Pross <naopross@thearcway.org>2018-12-12 18:13:11 +0100
commit3efa351a0a92e1c9c26d341adc2d0d64783ffa16 (patch)
tree628b487cb678e25edef98a1d9169762aa8ae72d8
parentAdd loaded member to sprites and minor corrections (diff)
downloadSubconscious-java-3efa351a0a92e1c9c26d341adc2d0d64783ffa16.tar.gz
Subconscious-java-3efa351a0a92e1c9c26d341adc2d0d64783ffa16.zip
Fix Map.getSize() to return a Dimension
-rw-r--r--src/subconscious/Map.java5
-rw-r--r--src/subconscious/Tile.java4
-rw-r--r--src/subconscious/graphics/MapScene.java4
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<Actor> 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);
}