diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-28 11:01:24 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-28 11:01:24 +0100 |
commit | 91a42e7e08b8aba942d6c306dbabd6db9543e83f (patch) | |
tree | 8e1f0474769db4c5703fd5abf92ec1b017e59ec1 /core | |
parent | d4a7c7bb113505bd38a6bca7d74cba5de3e94d69 (diff) | |
download | RustAndDust-91a42e7e08b8aba942d6c306dbabd6db9543e83f.zip RustAndDust-91a42e7e08b8aba942d6c306dbabd6db9543e83f.tar.gz |
Map: replace isIn...() with direct calls
Diffstat (limited to 'core')
4 files changed, 7 insertions, 32 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index ff58ebe..8ff031a 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -76,31 +76,6 @@ public abstract class Map extends Board return (Hex) moveAssists.get(0); } - public boolean isInPossibleMoves(Hex hex) - { - return possibleMoves.contains(hex); - } - - public boolean isInPossibleMoveAssists(Hex hex) - { - return moveAssists.contains(hex); - } - - public boolean isInPossibleAttackAssists(Hex hex) - { - return attackAssists.contains(hex); - } - - public boolean isInPossiblePaths(Hex hex) - { - return possiblePaths.contains(hex); - } - - public boolean isInPossibleTargets(Hex hex) - { - return possibleTargets.contains(hex); - } - public void selectHex(Hex hex, boolean enable) { enableOverlayOn(hex, Hex.SELECT, enable); diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java index 93431a1..f6d0694 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java @@ -47,7 +47,7 @@ public class StateAttack extends StateCommon public void touchUp() { // activePawn is the target - if ((activePawn == null) && map.isInPossibleTargets(upHex)) { + if ((activePawn == null) && map.possibleTargets.contains(upHex)) { map.showPossibleTargets(false); to = upHex; activePawn = to.getTopPawn(); @@ -57,7 +57,7 @@ public class StateAttack extends StateCommon ctrl.hud.show(false, false, false, true, true, ctrl.cfg.canCancel); } - if ((activePawn != null) && map.isInPossibleAttackAssists(upHex)) { + if ((activePawn != null) && map.attackAssists.contains(upHex)) { if (map.toggleAttackAssist(upHex.getTopPawn())) { map.showAssist(upHex, false); map.showTarget(upHex, true); diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index 08795c8..cef5039 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -61,12 +61,12 @@ public class StateMove extends StateCommon { int s = map.possiblePaths.size(); - if (map.isInPossibleMoveAssists(upHex) || (selectedPawn.canMove() && (selectedHex == upHex))) { + if (map.moveAssists.contains(upHex) || (selectedPawn.canMove() && (selectedHex == upHex))) { if(upHex != from) changePawn(upHex); - } else if ((s == 0) && map.isInPossibleMoves(upHex)) { + } else if ((s == 0) && map.possibleMoves.contains(upHex)) { s = buildPaths(); - } else if (map.isInPossiblePaths(upHex)) { + } else if (map.possiblePaths.contains(upHex)) { s = togglePoint(s); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 562c111..2b8f5e3 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -34,13 +34,13 @@ public class StateSelect extends StateCommon public void touchUp() { if (!isEnemy) { - if (map.isInPossibleMoves(upHex)) { + if (map.possibleMoves.contains(upHex)) { // quick move to = upHex; ctrl.setState(StateType.MOVE); return; } - if (map.isInPossibleTargets(upHex)) { + if (map.possibleTargets.contains(upHex)) { // quick fire to = upHex; ctrl.setState(StateType.ATTACK); |