summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-19 10:16:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-19 10:16:16 +0100
commit10a812dabf1518f68bb91e30ef05acd5514516a9 (patch)
tree1db0057b7cdc316551d79156fe327508d6268b99 /core/src/ch/asynk
parent747637fce3ac01f785f77d0a3592e756955d0107 (diff)
downloadRustAndDust-10a812dabf1518f68bb91e30ef05acd5514516a9.zip
RustAndDust-10a812dabf1518f68bb91e30ef05acd5514516a9.tar.gz
Player: promote does all the job, returns boolean
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/Player.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java
index ffca1a2..9bc1c2b 100644
--- a/core/src/ch/asynk/tankontank/game/Player.java
+++ b/core/src/ch/asynk/tankontank/game/Player.java
@@ -205,17 +205,16 @@ public class Player
return false;
}
- public Unit promote(Unit unit)
+ public boolean promote(Unit unit)
{
for (Unit p: casualties) {
if (p.isHqOf(unit)) {
- units.remove(unit);
- casualties.add(unit);
- units.add(p);
- casualties.remove(p);
- return p;
+ unit.promote();
+ p.degrade();
+ return true;
}
}
- return null;
+
+ return false;
}
}