diff --git a/src/enginuity/maps/TableSwitch.java b/src/enginuity/maps/TableSwitch.java index bd91d710..25d7f3ea 100644 --- a/src/enginuity/maps/TableSwitch.java +++ b/src/enginuity/maps/TableSwitch.java @@ -78,6 +78,15 @@ public class TableSwitch extends Table { on[i] = (byte) RomAttributeParser.parseHexString(tokens.nextToken()); } } + + public String getOnValues() { + StringBuffer values = new StringBuffer(); + for (int i = 0; i < on.length; i++) { + values.append(on[i]); + if (i < on.length) values.append(" "); + } + return values+""; + } public void setOffValues(String input) { StringTokenizer tokens = new StringTokenizer(input); @@ -86,6 +95,15 @@ public class TableSwitch extends Table { } } + public String getOffValues() { + StringBuffer values = new StringBuffer(); + for (int i = 0; i < off.length; i++) { + values.append(off[i]); + if (i < off.length) values.append(" "); + } + return values+""; + } + public Dimension getFrameSize() { int height = verticalOverhead + 75; int width = horizontalOverhead; diff --git a/src/enginuity/xml/DOMRomUnmarshaller.java b/src/enginuity/xml/DOMRomUnmarshaller.java index 2fbf9e83..b081a669 100644 --- a/src/enginuity/xml/DOMRomUnmarshaller.java +++ b/src/enginuity/xml/DOMRomUnmarshaller.java @@ -445,10 +445,10 @@ public final class DOMRomUnmarshaller { } else if (n.getNodeName().equalsIgnoreCase("state")) { // set on/off values for switch type if (unmarshallAttribute(n, "name", "").equalsIgnoreCase("on")) { - ((TableSwitch) table).setOnValues(unmarshallAttribute(n, "data", "0")); + ((TableSwitch) table).setOnValues(unmarshallAttribute(n, "data", ((TableSwitch)table).getOnValues())); } else if (unmarshallAttribute(n, "name", "").equalsIgnoreCase("off")) { - ((TableSwitch) table).setOffValues(unmarshallAttribute(n, "data", "0")); + ((TableSwitch) table).setOffValues(unmarshallAttribute(n, "data", ((TableSwitch)table).getOffValues())); }