From 77af3c2932a9a246e3ef10296cd62848f07d84f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 8 Dec 2015 21:38:39 +0100 Subject: Battle: no need of Player parameter anymore --- core/src/ch/asynk/rustanddust/game/Battle.java | 6 +++--- core/src/ch/asynk/rustanddust/game/Ctrl.java | 8 ++++---- core/src/ch/asynk/rustanddust/game/Hud.java | 2 +- core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 8 ++++---- core/src/ch/asynk/rustanddust/game/battles/BattleTest.java | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index fd384df..5e4a76d 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -32,11 +32,11 @@ public interface Battle public Zone getExitZone(Unit unit); - public Position getHudPosition(Player player); + public Position getHudPosition(); - public State.StateType getState(Player player); + public State.StateType getState(); - public boolean deploymentDone(Player player); + public boolean deploymentDone(); public void setup(Ctrl ctrl, Map map); } diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index ab1293a..dd45423 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -119,7 +119,7 @@ public class Ctrl implements Disposable if (battle.getReinforcement(this, map)) hud.notify("You have reinforcement", 2, Position.MIDDLE_CENTER, true); hud.update(); - setState(battle.getState(battle.getPlayer())); + setState(battle.getState()); } private void endPlayerTurn() @@ -136,7 +136,7 @@ public class Ctrl implements Disposable StateType nextState = this.state.abort(); if (nextState == StateType.ABORT) - nextState = battle.getState(battle.getPlayer()); + nextState = battle.getState(); return nextState; } @@ -166,7 +166,7 @@ public class Ctrl implements Disposable } if (nextState == StateType.DONE) - nextState = battle.getState(battle.getPlayer()); + nextState = battle.getState(); return nextState; } @@ -284,7 +284,7 @@ public class Ctrl implements Disposable public boolean checkDeploymentDone() { - boolean done = battle.deploymentDone(battle.getPlayer()); + boolean done = battle.deploymentDone(); if (done) hud.askEndDeployment(); return done; diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java index 779c4f9..3c1805f 100644 --- a/core/src/ch/asynk/rustanddust/game/Hud.java +++ b/core/src/ch/asynk/rustanddust/game/Hud.java @@ -91,7 +91,7 @@ public class Hud implements Disposable, Animation public void update() { - Position position = ctrl.battle.getHudPosition(ctrl.battle.getPlayer()); + Position position = ctrl.battle.getHudPosition(); playerInfo.update(ctrl.battle.getPlayer(), position); actionButtons.update(position.horizontalMirror()); } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 112deaf..4585fdd 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -93,15 +93,15 @@ public abstract class BattleCommon implements Battle } @Override - public boolean deploymentDone(Player player) + public boolean deploymentDone() { - return player.isDeploymentDone(); + return currentPlayer.isDeploymentDone(); } @Override - public StateType getState(Player player) + public StateType getState() { - if (!player.isDeploymentDone()) + if (!currentPlayer.isDeploymentDone()) return StateType.DEPLOYMENT; return StateType.SELECT; } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index 348e20a..df3ff2a 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -24,9 +24,9 @@ public class BattleTest extends BattleCommon } @Override - public Position getHudPosition(Player player) + public Position getHudPosition() { - return (player.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT); + return (currentPlayer.is(Army.US) ? Position.TOP_RIGHT: Position.TOP_LEFT); } @Override -- cgit v1.1-2-g2b99