From 3cbad22ab26755efcb4a2d6e9e8672138b5ab09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 10 May 2016 14:15:54 +0200 Subject: Ctrl: cleanup according to latest db changes --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 80bbd8f..bf944e8 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -431,15 +431,10 @@ public abstract class Ctrl implements Disposable setState(nextState); } else { if (!synched) { - storeState(); + storeGameState(); synched = true; } - if (battle.getPlayer().apExhausted()) - postTurnDone(); - else if (!battle.getPlayer().canDoSomething()) - postTurnDone(); - else - setState(battle.getState()); + checkPlayer(battle.getState()); } } @@ -452,7 +447,7 @@ public abstract class Ctrl implements Disposable game.ctrl.hud.engagementSummary(order.engagement); } if (this.mode == Mode.PLAY) - storeOrders(); + storeGameOrders(); hud.update(); } @@ -485,19 +480,26 @@ public abstract class Ctrl implements Disposable battle.getPlayer().burnDownOneAp(); hud.notify("1 Action Point burnt"); - hud.update(); + checkPlayer(nextState); + storeGameState(); + } + private void checkPlayer(StateType nextState) + { + // FIXME msg stacking + // FIXME maybe add default msg as param if (battle.getPlayer().apExhausted()) { - hud.notify("No more Action Points"); + if (mode == Mode.PLAY) + hud.notify("No more Action Points"); postTurnDone(); } else if (!battle.getPlayer().canDoSomething()) { - hud.notify("No available Actions"); + if (mode == Mode.PLAY) + hud.notify("No available Actions"); postTurnDone(); } else { post(nextState); } - - storeState(); + hud.update(); } private void completeOrder(Order order) @@ -540,6 +542,7 @@ public abstract class Ctrl implements Disposable if (debugCtrl) RustAndDust.debug(" TURN DONE"); setState(StateType.WAIT_EVENT); + storeTurnOrders(); if (battle.turnDone()) hud.victory(battle.getPlayer(), battle.getOpponent()); -- cgit v1.1-2-g2b99