From 509fb5c47eef512915e55a0bf6479cb5f879cb06 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 7 Dec 2001 05:14:57 +0000 Subject: [PATCH] Was missing the name attribute. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@752 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../spot/tools/xml/SpotSceneWriter.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java b/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java index d380f78e7..eb122a862 100644 --- a/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java +++ b/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java @@ -1,5 +1,5 @@ // -// $Id: SpotSceneWriter.java,v 1.5 2001/12/07 05:11:25 mdb Exp $ +// $Id: SpotSceneWriter.java,v 1.6 2001/12/07 05:14:57 mdb Exp $ package com.threerings.whirled.tools.spot.xml; @@ -65,18 +65,25 @@ public class SpotSceneWriter extends SceneWriter EditablePortal port = (EditablePortal)iter.next(); AttributesImpl attrs = new AttributesImpl(); addSharedAttrs(attrs, port); - if (port.targetSceneName != null) { - attrs.addAttribute("", "targetSceneName", "", "", - port.targetSceneName); - } - if (port.targetPortalName != null) { - attrs.addAttribute("", "targetPortalName", "", "", - port.targetPortalName); - } + maybeAddAttr(attrs, "name", port.name); + maybeAddAttr(attrs, "targetSceneName", port.targetSceneName); + maybeAddAttr(attrs, "targetPortalName", port.targetPortalName); writer.emptyElement("", "portal", "", attrs); } } + /** + * Adds the supplied attribute to the attributes object iff the value + * is non-null. + */ + protected void maybeAddAttr ( + AttributesImpl attrs, String name, String value) + { + if (value != null) { + attrs.addAttribute("", name, "", "", value); + } + } + /** * Adds the attributes that are shared between location and portal * elements.