From 4fa6f2f67942124bba185ce420d5c0362c049e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 25 Sep 2014 22:47:56 +0200 Subject: Board: add openToAttackFrom() --- core/src/ch/asynk/tankontank/engine/Board.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index e709bff..6bab3d0 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -306,6 +306,21 @@ public abstract class Board extends Image implements Disposable return areaPoints; } + public List openToAttackFrom(Pawn pawn, int col, int row) + { + for (GridPoint2 p : areaPoints) + gridPoint2Pool.free(p); + areaPoints.clear(); + + for (SearchBoard.Node node : searchBoard.openToAttackFrom(pawn, col, row)) { + GridPoint2 point = gridPoint2Pool.obtain(); + point.set(node.col, node.row); + areaPoints.add(point); + } + + return areaPoints; + } + public void clearOverlaysOn(int col, int row) { clearOverlaysOn(getTile(col, row)); -- cgit v1.1-2-g2b99