summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-02 10:18:22 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-02 10:18:22 +0100
commiteb4228baba57a85bacf870ba3532ac7fc53520b9 (patch)
tree4e80977cdb591a6144bc1425ae9cebe853daba1b
parent9dcca219e0293167bbcd732c4d226feb049e5179 (diff)
downloadRustAndDust-eb4228baba57a85bacf870ba3532ac7fc53520b9.zip
RustAndDust-eb4228baba57a85bacf870ba3532ac7fc53520b9.tar.gz
Map0Hex: add IterableArray<Hex> objectives
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map0Hex.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java
index aed7098..e40f58c 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java
@@ -6,18 +6,28 @@ import ch.asynk.rustanddust.RustAndDust;
import ch.asynk.rustanddust.engine.Tile;
import ch.asynk.rustanddust.engine.Board;
import ch.asynk.rustanddust.engine.SelectedTile;
+import ch.asynk.rustanddust.engine.util.IterableArray;
import ch.asynk.rustanddust.game.Hex;
import ch.asynk.rustanddust.game.Army;
public abstract class Map0Hex extends Board
{
protected final RustAndDust game;
+ protected final IterableArray<Hex> objectives;
public Map0Hex(final RustAndDust game, Texture map, SelectedTile hex)
{
super(game.factory, map, hex);
this.game = game;
+ this.objectives = new IterableArray<Hex>(10);
+ }
+
+ @Override
+ public void dispose()
+ {
+ objectives.clear();
+ super.dispose();
}
public Hex getHexAt(float x, float y)
@@ -45,6 +55,9 @@ public abstract class Map0Hex extends Board
Hex hex = getHex(col, row);
hex.setObjective(army, (persistent ? Tile.Objective.PERSISTENT : Tile.Objective.VERSATILE));
showObjective(hex, army, !persistent);
+ if (!objectives.contains(hex))
+ objectives.add(hex);
+ }
}
public void hexSelect(Hex hex) { selectedTile.set(hex); }