summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java16
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java16
3 files changed, 19 insertions, 15 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java
index 5b1451e..b6471dc 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 Map setup();
+ public State.StateType setup(Ctrl ctrl);
public boolean actionDone();
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 257df35..8b51867 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -62,6 +62,12 @@ public abstract class Ctrl implements Disposable
game.ctrl = this;
this.game = game;
this.battle = battle;
+ this.map = game.factory.getMap(battle.getMapType());
+ this.hud = new Hud(game);
+
+ this.blockMap = false;
+ this.blockHud = false;
+ this.touchedHex = null;
this.selectState = new StateSelect();
this.pathState = new StateMove();
@@ -76,17 +82,9 @@ public abstract class Ctrl implements Disposable
this.state = selectState;
this.stateType = StateType.DONE;
-
- this.blockMap = false;
- this.blockHud = false;
- this.touchedHex = null;
-
- this.map = battle.setup();
- this.hud = new Hud(game);
StateCommon.set(game);
- hud.update();
- setState(battle.getState());
+ setState(battle.setup(this));
this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false);
}
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index ff72408..f8ba8db 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -3,9 +3,11 @@ 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;
+import ch.asynk.rustanddust.game.State;
import ch.asynk.rustanddust.game.Map;
import ch.asynk.rustanddust.game.Zone;
import ch.asynk.rustanddust.game.Hex;
@@ -92,18 +94,22 @@ public abstract class BattleCommon implements Battle
}
@Override
- public Map setup()
+ public State.StateType setup(Ctrl ctrl)
{
- this.map = factory.getMap(mapType);
+ this.map = ctrl.map;
+ this.usPlayer = factory.getPlayer(Army.US);
+ this.gePlayer = factory.getPlayer(Army.GE);
+
+ ctrl.hud.update();
setupMap();
- this.currentPlayer = this.usPlayer = factory.getPlayer(Army.US);
+ this.currentPlayer = this.usPlayer;
setupUS();
map.actionDone();
currentPlayer.turnEnd();
map.turnDone();
- this.currentPlayer = this.gePlayer = factory.getPlayer(Army.GE);
+ this.currentPlayer = this.gePlayer;
setupGE();
map.actionDone();
currentPlayer.turnEnd();
@@ -111,7 +117,7 @@ public abstract class BattleCommon implements Battle
this.currentPlayer = getFirstPlayer();
- return this.map;
+ return getState();
}
@Override