diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-30 15:34:20 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-30 15:34:20 +0100 |
commit | c6b8b7ce0280380cc1aba188b66828f76d0cef27 (patch) | |
tree | 94dedd26712154e740f0b809bc34909a7b57218d | |
parent | 3a9ec668a055519e163e6dbfb0f78d382bb4b39c (diff) | |
download | RustAndDust-c6b8b7ce0280380cc1aba188b66828f76d0cef27.zip RustAndDust-c6b8b7ce0280380cc1aba188b66828f76d0cef27.tar.gz |
Board: clean up int collectAttackAssists(Pawn, Pawn, Iterator<Pawn>, PawnCollection)
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index f3faa01..a33bea0 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -298,15 +298,10 @@ public abstract class Board implements Disposable protected int collectAttackAssists(Pawn pawn, Pawn target, Iterator<Pawn> units, PawnCollection assists) { assists.clear(); - Tile to = target.getTile(); while (units.hasNext()) { Pawn p = units.next(); - if ((p == pawn) || !p.canAttack()) continue; - Tile from = p.getTile(); - if (searchBoard.collectAttack(p, !p.canAssistAttackWithoutLos(), target, from.getCol(), from.getRow(), to.getCol(), to.getRow())) { - if (p != pawn) - assists.add(p); - } + if (p.canAttack(target) && searchBoard.collectAttacks(p, target, !p.canAssistAttackWithoutLos())) + assists.add(p); } return assists.size(); |