diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 16:55:53 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 16:55:53 +0200 |
commit | cb5e7eb16dafeecb9c1750139af873a5d0d148c1 (patch) | |
tree | badb1709fb362eb4b5ed8f3622a7ca38baefc35e | |
parent | 563c88e55860d62c5a8b288c9ba8ed3c50930fe1 (diff) | |
download | RustAndDust-cb5e7eb16dafeecb9c1750139af873a5d0d148c1.zip RustAndDust-cb5e7eb16dafeecb9c1750139af873a5d0d148c1.tar.gz |
Board: buildxxx(...) retrun count of collected elements
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index dcb628a..6c5fb63 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -315,19 +315,21 @@ public abstract class Board implements Disposable } } - protected void buildPossibleMovesFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> moves) + protected int buildPossibleMovesFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> moves) { List<SearchBoard.Node> nodes = searchBoard.possibleMovesFrom(pawn, coords.x, coords.y); nodesToPoints(nodes, moves); + return moves.size(); } - protected void buildPossibleTargetsFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> targets) + protected int buildPossibleTargetsFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> targets) { List<SearchBoard.Node> nodes = searchBoard.possibleTargetsFrom(pawn, coords.x, coords.y); nodesToPoints(nodes, targets); + return targets.size(); } - protected void buildMoveAssists(Pawn pawn, GridPoint2 coords, List<GridPoint2> assists) + protected int buildMoveAssists(Pawn pawn, GridPoint2 coords, List<GridPoint2> assists) { assists.clear(); buildNeighboursFor(coords); @@ -341,6 +343,7 @@ public abstract class Board implements Disposable } } } + return assists.size(); } protected void buildAttackAssists(Pawn pawn, GridPoint2 hex, Iterator<Pawn> units, ArrayList<GridPoint2> assists) |