diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-14 11:16:06 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-14 11:16:06 +0200 |
commit | a34c377e53061db4d2affe8bda13d12fb1038911 (patch) | |
tree | 624816bfb9dd5bcf27e1190aa48b5cbc6f2ad4ec /core/src/ch/asynk/tankontank/game | |
parent | 9108226756b227265be365d40efa4b3942aa712a (diff) | |
download | RustAndDust-a34c377e53061db4d2affe8bda13d12fb1038911.zip RustAndDust-a34c377e53061db4d2affe8bda13d12fb1038911.tar.gz |
Board: add simpler buildPossibleTargetsFrom() based on enemy units
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateAttack.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateSelect.java | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index d1dfcb4..fdf7e8b 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -208,9 +208,10 @@ public abstract class Map extends Board return buildPossibleMovesFrom(pawn, hex, possibleMoves); } - public int buildPossibleTargets(Pawn pawn, GridPoint2 hex) + public int buildPossibleTargets(Pawn pawn, GridPoint2 hex, Iterator<Pawn> foes) { - return buildPossibleTargetsFrom(pawn, hex, possibleTargets); + // return buildPossibleTargetsFrom(pawn, hex, possibleTargets); + return buildPossibleTargetsFrom(pawn, hex, foes, possibleTargets); } public int buildMoveAssists(Pawn pawn, GridPoint2 hex) diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java index 7c4d6b2..bbf54d1 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java @@ -19,7 +19,7 @@ public class StateAttack extends StateCommon // use selectedHex and selectedPawn from.set(selectedHex); map.showPossibleTargets(false); - map.buildPossibleTargets(selectedPawn, from); + map.buildPossibleTargets(selectedPawn, from, ctrl.otherPlayer().unitIterator()); map.showPossibleTargets(true); if (to.x != -1) { // quick fire -> replay touchUp diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 0ae3465..5dc5e68 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -53,7 +53,7 @@ public class StateSelect extends StateCommon if (hasPawn() && (!isEnemy || ctrl.cfg.showEnemyPossibilities)) { int moves = map.buildPossibleMoves(selectedPawn, selectedHex); - int targets = map.buildPossibleTargets(selectedPawn, selectedHex); + int targets = map.buildPossibleTargets(selectedPawn, selectedHex, ctrl.otherPlayer().unitIterator()); int assists = map.buildMoveAssists(selectedPawn, selectedHex); showPossibleTargetsMovesAssists(selectedPawn); ctrl.hud.show( |