summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-21 16:20:17 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-21 16:20:17 +0200
commit937da67d9a9ce48f8e024f816485d83ea8fc5675 (patch)
tree1bd70904e02e48eeb95d24b2e1b3f1eef5b85dad /core
parentf7264e865d49673df59c6f8f08e323db41f8894b (diff)
downloadRustAndDust-937da67d9a9ce48f8e024f816485d83ea8fc5675.zip
RustAndDust-937da67d9a9ce48f8e024f816485d83ea8fc5675.tar.gz
add Map.enableOverlayOn(...)
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java13
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java4
2 files changed, 16 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 16a27d2..05f90f2 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -136,6 +136,19 @@ public abstract class Board extends Image implements Disposable
debugShapes.setTransformMatrix(prevTransform);
}
+ public void enableOverlayOn(int col, int row, int i, boolean enable)
+ {
+ enableOverlayOn(board[row][col], i, enable);
+ }
+
+ public void enableOverlayOn(Tile tile, int i, boolean enable)
+ {
+ if(tile.enableOverlay(i, enable))
+ tilesToDraw.add(tile);
+ else
+ tilesToDraw.remove(tile);
+ }
+
public Pawn getTopPawnAt(GridPoint2 cell)
{
return getTopPawnAt(cell.x, cell.y);
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index f7122fe..94f3435 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -69,9 +69,11 @@ public abstract class Tile implements BasicDrawable
return overlays.isEnabled();
}
- public void enableOverlay(int i, boolean enable)
+ public boolean enableOverlay(int i, boolean enable)
{
overlays.enable(i, enable);
+ if (enable) return true;
+ return mustBeDrawn();
}
public List<Tile> adjacents()