From 69bf2696555a68591b801128f89724788cbe3874 Mon Sep 17 00:00:00 2001 From: Jason Long Date: Sat, 27 Jul 2013 16:43:05 -0400 Subject: [PATCH] file-format: writeMap() use tags to indicate where new rows start --- src/micropolisj/engine/Micropolis.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/micropolisj/engine/Micropolis.java b/src/micropolisj/engine/Micropolis.java index 558362c..4014f8d 100644 --- a/src/micropolisj/engine/Micropolis.java +++ b/src/micropolisj/engine/Micropolis.java @@ -2053,9 +2053,10 @@ public class Micropolis throws XMLStreamException { out.writeStartElement("map"); - for (int x = 0; x < DEFAULT_WIDTH; x++) + for (int y = 0; y < DEFAULT_HEIGHT; y++) { - for (int y = 0; y < DEFAULT_HEIGHT; y++) + out.writeStartElement("mapRow"); + for (int x = 0; x < DEFAULT_WIDTH; x++) { int z = map[y][x]; if (isConductive(z & LOMASK)) { @@ -2073,13 +2074,14 @@ public class Micropolis if (isZoneCenter(z & LOMASK)) { z |= 1024; //synthesize ZONEBIT } - if (!(x==0 && y==0)) { - out.writeCharacters(","); + if (x != 0) { + out.writeCharacters(" "); } out.writeCharacters(Integer.toString(z)); } + out.writeEndElement(); //mapRow } - out.writeEndElement(); + out.writeEndElement(); //map } public void load(File filename)