summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-25 22:47:56 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-25 22:47:56 +0200
commit4fa6f2f67942124bba185ce420d5c0362c049e08 (patch)
treef8efe659ea2591101608273d60e23c67ee2f44f0 /core/src/ch/asynk/tankontank/engine
parent2ad9fa7d51f8ce833b47044d544ed4af7175ce10 (diff)
downloadRustAndDust-4fa6f2f67942124bba185ce420d5c0362c049e08.zip
RustAndDust-4fa6f2f67942124bba185ce420d5c0362c049e08.tar.gz
Board: add openToAttackFrom()
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java15
1 files changed, 15 insertions, 0 deletions
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<GridPoint2> 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));