From b24bf45d4dea25b6df5b9147465417d449a1d2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 11 Apr 2016 16:21:09 +0200 Subject: Unit: improve toString() --- core/src/ch/asynk/rustanddust/game/Unit.java | 7 ++++--- 1 file 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, -- cgit v1.1-2-g2b99