summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-02 10:24:17 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-02 10:24:17 +0100
commitdcbd6d747810954e6eef169294862c0dfbddd056 (patch)
tree5c29a13906b7458cfeef837a4cfa0d60549b0e01
parenteb4228baba57a85bacf870ba3532ac7fc53520b9 (diff)
downloadRustAndDust-dcbd6d747810954e6eef169294862c0dfbddd056.zip
RustAndDust-dcbd6d747810954e6eef169294862c0dfbddd056.tar.gz
Map0Hex: implement faster int objectivesCount(Army) then the one in Board
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map0Hex.java9
1 files changed, 9 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 e40f58c..607a1e4 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java
@@ -58,6 +58,15 @@ public abstract class Map0Hex extends Board
if (!objectives.contains(hex))
objectives.add(hex);
}
+
+ public int objectivesCount(Army army)
+ {
+ int n = 0;
+ for (Hex hex : objectives) {
+ if (hex.belongsTo(army))
+ n += 1;
+ }
+ return n;
}
public void hexSelect(Hex hex) { selectedTile.set(hex); }