file-format: writeMap() use tags to indicate where new rows start
This commit is contained in:
parent
a3d2c1f441
commit
69bf269655
1 changed files with 7 additions and 5 deletions
|
@ -2053,9 +2053,10 @@ public class Micropolis
|
||||||
throws XMLStreamException
|
throws XMLStreamException
|
||||||
{
|
{
|
||||||
out.writeStartElement("map");
|
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];
|
int z = map[y][x];
|
||||||
if (isConductive(z & LOMASK)) {
|
if (isConductive(z & LOMASK)) {
|
||||||
|
@ -2073,13 +2074,14 @@ public class Micropolis
|
||||||
if (isZoneCenter(z & LOMASK)) {
|
if (isZoneCenter(z & LOMASK)) {
|
||||||
z |= 1024; //synthesize ZONEBIT
|
z |= 1024; //synthesize ZONEBIT
|
||||||
}
|
}
|
||||||
if (!(x==0 && y==0)) {
|
if (x != 0) {
|
||||||
out.writeCharacters(",");
|
out.writeCharacters(" ");
|
||||||
}
|
}
|
||||||
out.writeCharacters(Integer.toString(z));
|
out.writeCharacters(Integer.toString(z));
|
||||||
}
|
}
|
||||||
|
out.writeEndElement(); //mapRow
|
||||||
}
|
}
|
||||||
out.writeEndElement();
|
out.writeEndElement(); //map
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(File filename)
|
public void load(File filename)
|
||||||
|
|
Reference in a new issue