summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-30 08:20:50 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-30 08:20:50 +0200
commit80245aa6e0ab38354a488ff91ce068e27b6acbab (patch)
tree4a4740c91a740fe887d1f5d086ef0f30a71f0c2b
parent0f3da1e779905a5c10fdeca62d7f2cea6b622e80 (diff)
downloadRustAndDust-80245aa6e0ab38354a488ff91ce068e27b6acbab.zip
RustAndDust-80245aa6e0ab38354a488ff91ce068e27b6acbab.tar.gz
Ctrl: nextState == StateType.DONE -> call complete() and handle REPLAY
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index bc44fd9..522b562 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -275,10 +275,7 @@ public abstract class Ctrl implements Disposable
if (nextState == StateType.ABORT)
nextState = abortAction();
else if (nextState == StateType.DONE) {
- if (stateType == StateType.DEPLOYMENT)
- nextState = completeDeployment();
- else
- nextState = completeAction();
+ nextState = complete();
}
if (stateType == StateType.ANIMATION) {
@@ -302,6 +299,18 @@ public abstract class Ctrl implements Disposable
turnDone();
}
+ private StateType complete()
+ {
+ switch(stateType) {
+ case DEPLOYMENT:
+ return completeDeployment();
+ case REPLAY:
+ return battle.getState();
+ default:
+ return completeAction();
+ }
+ }
+
private StateType completeDeployment()
{
if (battle.isDeploymentDone())