diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-28 10:59:48 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-28 10:59:48 +0100 |
commit | d4a7c7bb113505bd38a6bca7d74cba5de3e94d69 (patch) | |
tree | 070f11964cb89905df4eb907956dfe9a69ad41d2 /core | |
parent | a0ed984bfdad195e3ee1b32292a58ba1586d42b5 (diff) | |
download | RustAndDust-d4a7c7bb113505bd38a6bca7d74cba5de3e94d69.zip RustAndDust-d4a7c7bb113505bd38a6bca7d74cba5de3e94d69.tar.gz |
Map: replace ...Count() with direct calls
Diffstat (limited to 'core')
4 files changed, 8 insertions, 23 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index b0f383d..3ecb455 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -101,7 +101,7 @@ public class Ctrl implements Disposable private void checkTurnEnd() { - if (map.activatedPawnsCount() > 0) { + if (map.activatedPawns.size() > 0) { player.burnDownOneAp(); } if (player.apExhausted()) diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index fed7db0..ff58ebe 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -76,21 +76,6 @@ public abstract class Map extends Board return (Hex) moveAssists.get(0); } - public int activablePawnsCount() - { - return activablePawns.size(); - } - - public int activatedPawnsCount() - { - return activatedPawns.size(); - } - - public int possiblePathsSize() - { - return possiblePaths.size(); - } - public boolean isInPossibleMoves(Hex hex) { return possibleMoves.contains(hex); @@ -300,7 +285,7 @@ public abstract class Map extends Board for (Pawn p : activatedPawns) pawn.attack(target); - if ((activatedPawnsCount() == 1) && pawn.isA(Unit.UnitType.AT_GUN) && target.isHardTarget()) + if ((activatedPawns.size() == 1) && pawn.isA(Unit.UnitType.AT_GUN) && target.isHardTarget()) activatedPawns.clear(); return success; diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index e959376..08795c8 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -9,7 +9,7 @@ public class StateMove extends StateCommon public void enter(boolean fromSelect) { map.possiblePaths.clear(); - ctrl.hud.show(false, true, true, false, ((map.activablePawnsCount() + map.activatedPawnsCount()) > 1), ctrl.cfg.canCancel); + ctrl.hud.show(false, true, true, false, ((map.activablePawns.size() + map.activatedPawns.size()) > 1), ctrl.cfg.canCancel); ctrl.hud.moveBtn.setOn(); if (fromSelect) { @@ -59,7 +59,7 @@ public class StateMove extends StateCommon @Override public void touchUp() { - int s = map.possiblePathsSize(); + int s = map.possiblePaths.size(); if (map.isInPossibleMoveAssists(upHex) || (selectedPawn.canMove() && (selectedHex == upHex))) { if(upHex != from) @@ -82,7 +82,7 @@ public class StateMove extends StateCommon public void abort() { hideAssists(); - ctrl.setAnimationCount(map.activatedPawnsCount()); + ctrl.setAnimationCount(map.activatedPawns.size()); map.revertMoves(); super.abort(); } @@ -91,7 +91,7 @@ public class StateMove extends StateCommon public void done() { hideAssists(); - if (selectedPawn.canMove() && (map.activatedPawnsCount() > 0)) + if (selectedPawn.canMove() && (map.activatedPawns.size() > 0)) selectedPawn.move(0); super.done(); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index e127bda..7bb3f28 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -74,7 +74,7 @@ public class StateRotate extends StateCommon public void abort() { ctrl.hud.hide(); - if (map.activatedPawnsCount() == 0) { + if (map.activatedPawns.size() == 0) { hideAssists(); super.abort(); } else { @@ -86,7 +86,7 @@ public class StateRotate extends StateCommon public void done() { doRotation(o); - if (selectedPawn.canMove() && (map.activatedPawnsCount() > 0)) + if (selectedPawn.canMove() && (map.activatedPawns.size() > 0)) selectedPawn.move(0); super.done(); } |