summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-18 17:12:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-18 17:12:16 +0100
commit66f490fedf3545bc0a239d466d85d3d1a71feac6 (patch)
tree66863bdc726d8ff42aea70cc04e7afdbbf666379
parentc2b247ae75d4825b33a5b328c9ef62952b5bfaa1 (diff)
downloadRustAndDust-66f490fedf3545bc0a239d466d85d3d1a71feac6.zip
RustAndDust-66f490fedf3545bc0a239d466d85d3d1a71feac6.tar.gz
Hex: use String.format for toString(), add toShort()
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java
index 6e89df4..5fa1ee6 100644
--- a/core/src/ch/asynk/tankontank/game/Hex.java
+++ b/core/src/ch/asynk/tankontank/game/Hex.java
@@ -39,7 +39,12 @@ public class Hex extends Tile
public String toString()
{
- return "(" + col + ";" + row + ") [" + x + ";" + y + "] " + "t:" + terrain + " r:" + roads;
+ return String.format("(%d;%d) [%f;%f] t:%s r:%d", col, row, x, y, terrain, roads);
+ }
+
+ public String toShort()
+ {
+ return String.format("(%d;%d)", col, row);
}
public Hex(float x, float y, int col, int row, TextureAtlas atlas)