summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-19 10:17:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-19 10:17:03 +0100
commitd2737a89a46694622e9206ac1704f23f9601d2ef (patch)
tree679cfc28108bc70f9448fe89fad61cbacb19e315 /core/src/ch
parent10a812dabf1518f68bb91e30ef05acd5514516a9 (diff)
downloadRustAndDust-d2737a89a46694622e9206ac1704f23f9601d2ef.zip
RustAndDust-d2737a89a46694622e9206ac1704f23f9601d2ef.tar.gz
StatePromote: use Player.promote(), set activatedPawns, unselect on leave
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StatePromote.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java
index cf628d9..3d83ec3 100644
--- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java
+++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java
@@ -8,19 +8,18 @@ public class StatePromote extends StateCommon
public void enter(StateType prevState)
{
ctrl.hud.actionButtons.hide();
- Unit unit = ctrl.player.promote(selectedUnit);
- if (unit != null) {
- // TODO this must burn 1 AP down !!!!!
- ctrl.hud.notify(unit + " has been promoted");
- selectedUnit.promote();
- unit.degrade();
+ String str = selectedUnit.toString();
+ if (ctrl.player.promote(selectedUnit)) {
+ map.activatedPawns.add(selectedUnit);
+ ctrl.hud.notify(str+ " has been promoted");
}
- done();
+ ctrl.setState(StateType.DONE);
}
@Override
public void leave(StateType nextState)
{
+ map.unselectHex(selectedHex);
}
@Override