summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-04-11 16:21:09 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-04-11 16:21:09 +0200
commitb24bf45d4dea25b6df5b9147465417d449a1d2ad (patch)
tree247264a3a743eb7ea826ca69fa6993b422426562 /core
parent078c5339b2df6d94eba9fbdcc9f1153628c8cb1c (diff)
downloadRustAndDust-b24bf45d4dea25b6df5b9147465417d449a1d2ad.zip
RustAndDust-b24bf45d4dea25b6df5b9147465417d449a1d2ad.tar.gz
Unit: improve toString()
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Unit.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java
index 41e392b..7894f81 100644
--- a/core/src/ch/asynk/rustanddust/game/Unit.java
+++ b/core/src/ch/asynk/rustanddust/game/Unit.java
@@ -74,7 +74,7 @@ public class Unit extends HeadedPawn
super(army, chit, body, turret, overlays);
hq = false;
ace = false;
- this. id = unit_id;
+ this.id = unit_id;
unit_id += 1;
this.entryZone = null;
this.exitZone = null;
@@ -92,10 +92,11 @@ public class Unit extends HeadedPawn
private void updateDescr()
{
+ this.descr = String.format("[%d] %s%s%s (%d - %d", id, code.toString(), (hq ? " HQ" : ""), (ace ? " Ace" : ""), rng, def);
if (cdef == -1)
- this.descr = code.toString() + (hq ? " HQ " : "") + (ace ? " Ace " : "") + " (" + rng + "-" + def + "-" + mp + ")";
+ this.descr += "-" + mp + ")";
else
- this.descr = code.toString() + (hq ? " HQ " : "") + (ace ? " Ace " : "") + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")";
+ this.descr += "/" + cdef + "-" + mp + ")";
}
public Unit(Army army, UnitCode code, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints,