summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-20 14:30:33 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-20 14:30:33 +0100
commitace9bc6875f0037e432f0d718495d09c55615ac3 (patch)
tree42eddc0bc7de79f10e53ae620e764ed0175ebd4a /core/src/ch/asynk/tankontank/engine
parent893541b6132bf71e62c4cc4d3bcec844dee0b4be (diff)
downloadRustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.zip
RustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.tar.gz
engine.PawnSet is dead : welcome UnitSet
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java15
-rw-r--r--core/src/ch/asynk/tankontank/engine/PawnSet.java26
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java2
3 files changed, 5 insertions, 38 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index cc3b08f..080eb33 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -1,6 +1,5 @@
package ch.asynk.tankontank.engine;
-import java.util.List;
import java.util.Iterator;
import java.util.Collection;
import java.util.ArrayList;
@@ -32,12 +31,6 @@ public abstract class Board implements Disposable
public Tile getNewTile(float x, float y, int col, int row, boolean offmap);
}
- public interface PawnCollection extends Collection<Pawn>
- {
- public Pawn first();
- public void enable(int i, boolean enable);
- }
-
public static class Config
{
public int cols;
@@ -292,12 +285,12 @@ public abstract class Board implements Disposable
return searchBoard.possibleMovesFrom(pawn, moves);
}
- protected int collectPossibleTargets(Pawn pawn, PawnCollection targets)
+ protected int collectPossibleTargets(Pawn pawn, Collection<Pawn> targets)
{
return searchBoard.possibleTargetsFrom(pawn, targets);
}
- protected int collectPossibleTargets(Pawn pawn, List<Pawn> units, PawnCollection targets)
+ protected int collectPossibleTargets(Pawn pawn, Collection<Pawn> units, Collection<Pawn> targets)
{
targets.clear();
for (Pawn target : units) {
@@ -308,7 +301,7 @@ public abstract class Board implements Disposable
return targets.size();
}
- protected int collectMoveAssists(Pawn pawn, PawnCollection assists)
+ protected int collectMoveAssists(Pawn pawn, Collection<Pawn> assists)
{
assists.clear();
setAdjacentTiles(pawn.getTile(), neighbours);
@@ -326,7 +319,7 @@ public abstract class Board implements Disposable
return assists.size();
}
- protected int collectAttackAssists(Pawn pawn, Pawn target, List<Pawn> units, PawnCollection assists)
+ protected int collectAttackAssists(Pawn pawn, Pawn target, Collection<Pawn> units, Collection<Pawn> assists)
{
assists.clear();
for (Pawn p : units) {
diff --git a/core/src/ch/asynk/tankontank/engine/PawnSet.java b/core/src/ch/asynk/tankontank/engine/PawnSet.java
deleted file mode 100644
index 0df2332..0000000
--- a/core/src/ch/asynk/tankontank/engine/PawnSet.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package ch.asynk.tankontank.engine;
-
-import java.util.LinkedHashSet;
-
-public class PawnSet extends LinkedHashSet<Pawn> implements Board.PawnCollection
-{
- private final Board board;
-
- public PawnSet(Board board, int n)
- {
- super(n);
- this.board = board;
- }
-
- public Pawn first()
- {
- if (isEmpty()) return null;
- return iterator().next();
- }
-
- public void enable(int i, boolean enable)
- {
- for (Pawn pawn : this)
- pawn.enableOverlay(i, enable);
- }
-}
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 227d19a..99b662e 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -259,7 +259,7 @@ public class SearchBoard
a[5] = null;
}
- public int possibleTargetsFrom(Pawn pawn, Board.PawnCollection targets)
+ public int possibleTargetsFrom(Pawn pawn, Collection<Pawn> targets)
{
targets.clear();
searchCount += 1;