From 937da67d9a9ce48f8e024f816485d83ea8fc5675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 21 Sep 2014 16:20:17 +0200 Subject: add Map.enableOverlayOn(...) --- core/src/ch/asynk/tankontank/engine/Board.java | 13 +++++++++++++ core/src/ch/asynk/tankontank/engine/Tile.java | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) 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 adjacents() -- cgit v1.1-2-g2b99