From dcbd6d747810954e6eef169294862c0dfbddd056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 2 Feb 2016 10:24:17 +0100 Subject: Map0Hex: implement faster int objectivesCount(Army) then the one in Board --- core/src/ch/asynk/rustanddust/game/map/Map0Hex.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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); } -- cgit v1.1-2-g2b99