From 77a2f3c56ff1f7faa9a60df239c35c502780b67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 16 Nov 2014 16:21:34 +0100 Subject: Battle: setup(Map, Player, Player) -> setup(Ctrl, Map) --- core/src/ch/asynk/tankontank/game/Battle.java | 2 +- core/src/ch/asynk/tankontank/game/Ctrl.java | 2 +- .../game/battles/BattleFrontalAssault.java | 18 +++++------------- .../tankontank/game/battles/BattleHeadToHead.java | 20 ++++++-------------- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/Battle.java b/core/src/ch/asynk/tankontank/game/Battle.java index 13e3162..7e52632 100644 --- a/core/src/ch/asynk/tankontank/game/Battle.java +++ b/core/src/ch/asynk/tankontank/game/Battle.java @@ -25,5 +25,5 @@ public interface Battle public boolean deploymentDone(Player player); - public void setup(Map map, Player firstPlayer, Player secondPlayer); + public void setup(Ctrl ctrl, Map map); } diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 78fdeba..77bc56f 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -56,7 +56,7 @@ public class Ctrl implements Disposable this.player = battle.getPlayer(true, false); this.opponent = battle.getPlayer(false, false); this.map = battle.getMap(); - battle.setup(map, player, opponent); + battle.setup(this, map); this.selectState = new StateSelect(this, map); this.pathState = new StateMove(); diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java index 9942289..1297def 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleFrontalAssault.java @@ -71,24 +71,16 @@ public class BattleFrontalAssault extends BattleCommon } if (count > 1) - return (ctrl.player.is(Army.US) ? ctrl.player : ctrl.opponent); + return ctrl.getPlayer(Army.US); else - return (ctrl.player.is(Army.GE) ? ctrl.player : ctrl.opponent); + return ctrl.getPlayer(Army.GE); } @Override - public void setup(Map map, Player a, Player b) + public void setup(Ctrl ctrl, Map map) { - Player gePlayer; - Player usPlayer; - - if (a.is(Army.US)) { - usPlayer = a; - gePlayer = b; - } else { - usPlayer = b; - gePlayer = a; - } + Player gePlayer = ctrl.getPlayer(Army.GE); + Player usPlayer = ctrl.getPlayer(Army.US); objectives = new TileSet(map, 3); objectives.add(map.getHex(2, 2)); diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java index c77d0e8..2307486 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleHeadToHead.java @@ -76,21 +76,13 @@ public class BattleHeadToHead extends BattleCommon } @Override - public void setup(Map map, Player a, Player b) + public void setup(Ctrl ctrl, Map map) { - Player gePlayer; - Player usPlayer; - - a.deploymentDone(); - b.deploymentDone(); - - if (a.is(Army.US)) { - usPlayer = a; - gePlayer = b; - } else { - usPlayer = b; - gePlayer = a; - } + Player gePlayer = ctrl.getPlayer(Army.GE); + Player usPlayer = ctrl.getPlayer(Army.US); + + gePlayer.deploymentDone(); + usPlayer.deploymentDone(); objectives = new TileSet(map, 3); objectives.add(map.getHex(7, 7)); -- cgit v1.1-2-g2b99