summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-30 15:34:20 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-30 15:34:20 +0100
commitc6b8b7ce0280380cc1aba188b66828f76d0cef27 (patch)
tree94dedd26712154e740f0b809bc34909a7b57218d /core
parent3a9ec668a055519e163e6dbfb0f78d382bb4b39c (diff)
downloadRustAndDust-c6b8b7ce0280380cc1aba188b66828f76d0cef27.zip
RustAndDust-c6b8b7ce0280380cc1aba188b66828f76d0cef27.tar.gz
Board: clean up int collectAttackAssists(Pawn, Pawn, Iterator<Pawn>, PawnCollection)
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java9
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();