summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-29 16:47:32 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-29 16:47:32 +0200
commit5278b42d55ed8fc0e65d2aec329ff139851e060a (patch)
tree5330cf72b473ccc2dd60be2175eadd0afe24019c
parentb8a9be7e743b46eec0feb17e91e576ad033f6834 (diff)
downloadRustAndDust-5278b42d55ed8fc0e65d2aec329ff139851e060a.zip
RustAndDust-5278b42d55ed8fc0e65d2aec329ff139851e060a.tar.gz
StateReplay: fix selectedUnit
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateReplay.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateReplay.java b/core/src/ch/asynk/rustanddust/game/states/StateReplay.java
index 19c9e42..013ca65 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateReplay.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateReplay.java
@@ -23,9 +23,11 @@ public class StateReplay extends StateCommon
private void setup()
{
+ int s = order.activable.size();
+
switch (order.type) {
case MOVE:
- selectedUnit = order.activable.get(order.activable.size() - 1);
+ selectedUnit = ((s > 0) ? order.activable.get(s - 1) : order.unit);
break;
case ENGAGE:
to = order.engagement.defender.getHex();