summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-27 12:13:02 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-27 22:26:28 +0100
commit8a15825b13459d74e1ce157c90881dad92c87e3d (patch)
tree4f07ac6b66a9e04f7e43d7389bedddea03d64b79
parentea54afb0ce7fe12d5f96114d767244e7505a8a5c (diff)
downloadRustAndDust-8a15825b13459d74e1ce157c90881dad92c87e3d.zip
RustAndDust-8a15825b13459d74e1ce157c90881dad92c87e3d.tar.gz
Battle,Ctrl: clean up initialisation phase
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java7
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