summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-19 14:17:44 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-19 14:17:44 +0100
commit914f2ca4d0569f37d712a54f498b8fc6765aed5f (patch)
treeff3ec1cff15ac1e211f847b0fff6f80461f8a336 /core/src
parent806ad0b70ba6e276afdd873076c66949bd8f4cd8 (diff)
downloadRustAndDust-914f2ca4d0569f37d712a54f498b8fc6765aed5f.zip
RustAndDust-914f2ca4d0569f37d712a54f498b8fc6765aed5f.tar.gz
Ctrl: do not simply switch players on turn end but ask for the next one
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java39
1 files changed, 15 insertions, 24 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index 234b1f9..849742e 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -55,10 +55,10 @@ public class Ctrl implements Disposable
this.cfg = game.config;
game.ctrl = this;
- this.player = battle.getPlayer(true, true);
- this.opponent = battle.getPlayer(false, true);
this.map = battle.getMap();
battle.setup(this, map);
+ this.player = battle.getPlayer();
+ this.opponent = battle.opponent(player);
this.selectState = new StateSelect(this, map);
this.pathState = new StateMove();
@@ -139,16 +139,6 @@ public class Ctrl implements Disposable
hud.victory(winner, ((winner == player) ? opponent : player));
}
- private void switchPlayer()
- {
- TankOnTank.debug("Ctrl", "switch Players");
- endPlayerTurn();
- Player tmp = player;
- player = opponent;
- opponent = tmp;
- startPlayerTurn();
- }
-
private StateType actionAborted()
{
hud.notify("Action canceled");
@@ -160,6 +150,14 @@ public class Ctrl implements Disposable
return nextState;
}
+ private void turnDone()
+ {
+ endPlayerTurn();
+ player = battle.getPlayer();
+ opponent = battle.opponent(player);
+ startPlayerTurn();
+ }
+
private StateType actionDone()
{
StateType nextState = this.state.done();
@@ -183,15 +181,7 @@ public class Ctrl implements Disposable
private StateType deploymentDone()
{
StateType nextState = this.state.done();
-
- if (player.isDeploymentDone() && opponent.isDeploymentDone()) {
- endPlayerTurn();
- player = battle.getPlayer(true, false);
- opponent = battle.getPlayer(false, false);
- startPlayerTurn();
- } else
- switchPlayer();
-
+ turnDone();
return nextState;
}
@@ -306,10 +296,11 @@ public class Ctrl implements Disposable
game.setScreen(new OptionsScreen(game));
}
- public void abortPlayerTurn()
+ public void endPlayerTurn(boolean abort)
{
- state.abort();
- switchPlayer();
+ if (abort)
+ state.abort();
+ turnDone();
}
public void exitBoard(boolean doit)