From 8a15825b13459d74e1ce157c90881dad92c87e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 27 Jan 2016 12:13:02 +0100 Subject: Battle,Ctrl: clean up initialisation phase --- core/src/ch/asynk/rustanddust/game/Battle.java | 2 +- core/src/ch/asynk/rustanddust/game/Ctrl.java | 6 +++++- core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 7 +------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index b6471dc..3e958f6 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -19,7 +19,7 @@ public interface Battle public Position getHudPosition(); - public State.StateType setup(Ctrl ctrl); + public void init(); public boolean actionDone(); diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 29202fa..ffb37df 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -91,9 +91,13 @@ public abstract class Ctrl implements Disposable this.stateType = StateType.DONE; StateCommon.set(game); - setState(battle.setup(this)); + battle.init(); + init(); + hud.update(); this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); + + setState(battle.getState()); } @Override diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index be55d2e..205af5e 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -3,7 +3,6 @@ package ch.asynk.rustanddust.game.battles; import java.util.Random; import java.util.HashMap; -import ch.asynk.rustanddust.game.Ctrl; import ch.asynk.rustanddust.game.Army; import ch.asynk.rustanddust.game.Battle; import ch.asynk.rustanddust.game.Player; @@ -94,14 +93,12 @@ public abstract class BattleCommon implements Battle } @Override - public State.StateType setup(Ctrl ctrl) + public void init() { this.map = ctrl.map; this.usPlayer = factory.getPlayer(Army.US); this.gePlayer = factory.getPlayer(Army.GE); - ctrl.hud.update(); - ctrl.init(); setupMap(); this.currentPlayer = this.usPlayer; @@ -117,8 +114,6 @@ public abstract class BattleCommon implements Battle map.turnDone(); this.currentPlayer = getFirstPlayer(); - - return getState(); } @Override -- cgit v1.1-2-g2b99